Skip to content

Commit

Permalink
[xabuild] Reference missing assembly for newer Mono versions (dotnet#…
Browse files Browse the repository at this point in the history
…1976)

Context: dotnet#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.
  • Loading branch information
jonathanpeppers authored and jonpryor committed Aug 2, 2018
1 parent e3a7794 commit 43362f9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tools/xabuild/xabuild.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
<Reference Include="MSBuild">
<HintPath>$(MSBuildReferencePath)\MSBuild.$(_MSBuildExtension)</HintPath>
</Reference>
<Reference Include="System.Reflection.Metadata" Condition=" '$(OS)' != 'Windows_NT' ">
<HintPath>$(MSBuildReferencePath)\System.Reflection.Metadata.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml" />
Expand Down

0 comments on commit 43362f9

Please sign in to comment.