MrAdviceWeaverPath not defined in Xamarin.Android project
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'
What if you build with .NET 6? Is AssemblyPath still undefined? If yes, we can’t default to .NET 5.
With .NET6 Android (currently in preview) it is defined. $(TargetFrameworkIdentifier) is defined as .NETCoreApp.
Could you tell me if 2.9.6-testing1 solves your problem?
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
Do you get this error at package install, not at build?
Yes, at package install.
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.
Thank you