-
Notifications
You must be signed in to change notification settings - Fork 564
[xabuild] reference missing assembly on newer Mono versions #1976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[xabuild] reference missing assembly on newer Mono versions #1976
Conversation
Context: dotnet#1975 In newer versions of Mono, `xabuild` is failing with: /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(2126,5): error MSB3248: Parameter "AssemblyFiles" has invalid value "xamarin-android/bin/Debug/lib/xamarin.android/xbuild-frameworks/MonoAndroid/v1.0/mscorlib.dll". Could not load file or assembly 'System.Reflection.Metadata, Version=1.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Or another example: Mono: The following assembly referenced from monodroid/external/xamarin-android/bin/Debug/bin/Microsoft.Build.Tasks.Core.dll could not be loaded: Assembly: System.Reflection.Metadata (assemblyref_index=7) Version: 1.3.0.0 Public Key: b03f5f7f11d50a3a Looking at copies of `System.Reflection.Metadata` in my Mono installation: $ find /Library/Frameworks/Mono.framework/ | grep System.Reflection.Metadata.dll$ /Library/Frameworks/Mono.framework//Versions/5.12.0/lib/mono/msbuild/15.0/bin/System.Reflection.Metadata.dll /Library/Frameworks/Mono.framework//Versions/5.12.0/lib/mono/msbuild/15.0/bin/Roslyn/System.Reflection.Metadata.dll /Library/Frameworks/Mono.framework//Versions/5.12.0/lib/mono/fsharp/System.Reflection.Metadata.dll /Library/Frameworks/Mono.framework//Versions/5.12.0/lib/mono/4.5/System.Reflection.Metadata.dll /Library/Frameworks/Mono.framework//Versions/5.12.0/lib/mono/4.5/dim/System.Reflection.Metadata.dll It appears that the Mono version of MSBuild has its own copy of `System.Reflection.Metadata.dll`. Referencing this MSBuild-specific assembly from `xabuild.csproj` on non-Windows platforms appears to solve the problem.
|
I'm not sure I understand how this change will fix the MSB3248 error. How does adding the |
|
Without this explicit reference, does xabuild.exe end up with a reference to SRM at all? Is this just to get a local copy of SRM? |
|
I installed this Mono: https://download.mono-project.com/archive/5.14.0/macos-10-universal/MonoFramework-MDK-5.14.0.167.macos10.xamarin.universal.pkg And I could get the failure by just running: And the error is: The offending MSBuild target looks like it is here: https://github.com/xamarin/xamarin-android/blob/5995f0c63943bacb807100785b3c85697d258f46/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets#L2619 After adding the change in this PR, it fixes it? Not sure why... The existence of the SRM assembly in |
(Insert hysterical laughing here.) |
|
@jonpryor here are two logs: logs.zip Plaintext logs (can't read without newer Mono apparently): Only difference in the one that works is that I built |
|
Could you check whether SRM is present anywhere under the msbuild bin dir on windows? |
|
@radical here is what I have for 15.7.5 And then 15.8 P5 (appears the same): |
|
@jonathanpeppers ah, that makes sense. SRM is used on !windows like coreclr and mono to allow reading metadata from assemblies without actually loading them. And for windows they use windows APIs. So, what is referencing SRM then? Do you have any of Microsoft.Build* assemblies being local copied, even after #1975? Try with a build from #1975 . That hopefully should work, because mono's msbuild assemblies would be referencing SRM (correctly), so removing those and having the assembly resolver using the windows msbuild assemblies, should remove the need for SRM completely. |
Context: #1975 Mono 2018-04 (or 5.14.x) has some changes to MSBuild assemblies that cause failures such as the following when using `xabuild.exe`: /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(2126,5): error MSB3248: Parameter "AssemblyFiles" has invalid value "xamarin-android/bin/Debug/lib/xamarin.android/xbuild-frameworks/MonoAndroid/v1.0/mscorlib.dll". Could not load file or assembly 'System.Reflection.Metadata, Version=1.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Mono: The following assembly referenced from monodroid/external/xamarin-android/bin/Debug/bin/Microsoft.Build.Tasks.Core.dll could not be loaded: Assembly: System.Reflection.Metadata (assemblyref_index=7) Version: 1.3.0.0 Public Key: b03f5f7f11d50a3a It appears that the Mono version of MSBuild has its own copy of `System.Reflection.Metadata.dll`. Referencing this MSBuild-specific assembly from `xabuild.csproj` on non-Windows platforms appears to fix the above errors.
Context: #1975
In newer versions of Mono,
xabuildis failing with:Or another example:
Looking at copies of
System.Reflection.Metadatain my Monoinstallation:
It appears that the Mono version of MSBuild has its own copy of
System.Reflection.Metadata.dll. Referencing this MSBuild-specificassembly from
xabuild.csprojon non-Windows platforms appears tosolve the problem.