ArxOne / MrAdvice

.NET aspect weaver (build task under NuGet package)
MIT License
308 stars 45 forks source link

MrAdviceWeaverPath not defined in Xamarin.Android project #180

Closed rgroenewoudt closed 1 year ago

rgroenewoudt commented 2 years ago

In a Xamarin.Android project the latest MrAdvice is failing to run.

 'AssemblyPath' is not recognized as an internal or external command,
 operable program or batch file.
C:\xxxxxxx\packages\MrAdvice.2.9.5\build\MrAdvice.targets(14,5): error MSB3073: The command " AssemblyPath="obj\Debug x86\90\xxxxxxx.Android.dll" ReferencePath="@obj\Debug x86\90\xxxxxxx.Android.dll.MrAdvice.ReferencePath.txt" ReferenceCopyLocalPaths="@obj\Debug x86\90\xxxxxxx.Android.dll.MrAdvice.LocalReferencePath.txt" AssemblyOriginatorKeyFile="" SignAssembly=""" exited with code 9009.

This is because property MrAdviceWeaverPath is not defined. Xamarin project doesn't have $(TargetFrameworkIdentifier) as .NETFramework or .NETCoreApp or .NETStandard.

Using net5.0\MrAdvice.Weaver.exe seems to work fine so it might be a good idea to always use that one if $(TargetFrameworkIdentifier)' not equals to '.NETFramework'

picrap commented 2 years ago

What if you build with .NET 6? Is AssemblyPath still undefined? If yes, we can’t default to .NET 5.

rgroenewoudt commented 2 years ago

With .NET6 Android (currently in preview) it is defined. $(TargetFrameworkIdentifier) is defined as .NETCoreApp.

picrap commented 2 years ago

Could you tell me if 2.9.6-testing1 solves your problem?

rgroenewoudt commented 2 years ago

Yes, building works with 2.9.6-testing1.

Other strange thing: when installing the Nuget package I get the following error in the Errors list once but it doesn't seem to affect building:

Severity    Code    Description Project File    Line    Suppression State
Warning     The command ""C:\Users\x\.nuget\packages\mradvice\2.9.6-testing1\build\..\tools\net5.0\MrAdvice.Weaver.exe" AssemblyPath="obj\Debug\120\App2.dll" ReferencePath="@obj\Debug\120\App2.dll.MrAdvice.ReferencePath.txt" ReferenceCopyLocalPaths="@obj\Debug\120\App2.dll.MrAdvice.LocalReferencePath.txt" AssemblyOriginatorKeyFile="" SignAssembly=""" exited with code 2.    App2            
picrap commented 2 years ago

Do you get this error at package install, not at build?

rgroenewoudt commented 2 years ago

Yes, at package install.

rgroenewoudt commented 1 year ago

It would be fine to close this bug as Xamarin is getting replaced with new .NET 6 Android and MrAdvice works well in .NET 6.

picrap commented 1 year ago

Thank you