Skip to content

Commit 4873dfa

Browse files
[xabuild] update binding redirects for MSBuild 17.3 (#7273)
`xabuild Xamarin.Android-Tests.sln` was failing with: MSBUILD : error MSB1025: An internal failure occurred while running MSBuild. System.IO.FileLoadException: Could not load file or assembly 'System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) File name: 'System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' at Microsoft.Build.Shared.FileUtilities.LooksLikeUnixFilePath(String value, String baseDirectory) at Microsoft.Build.CommandLine.MSBuildApp.GatherCommandLineSwitches(List`1 commandLineArgs, CommandLineSwitches commandLineSwitches, String commandLine) at Microsoft.Build.CommandLine.MSBuildApp.GatherAllSwitches(String commandLine, CommandLineSwitches& switchesFromAutoResponseFile, CommandLineSwitches& switchesNotFromAutoResponseFile) at Microsoft.Build.CommandLine.MSBuildApp.Execute(String commandLine) This appears to be happening on Windows build machines running Visual Studio 2022 17.3 and MSBuild 17.3. I did an audit comparing xabuild's `App.config` file with: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe.config We needed to update specifically to: * System.Memory 4.5.5 * System.Collections.Immutable 6.0.0 * System.Runtime.CompilerServices.Unsafe 6.0.0 Note that in some cases the NuGet package version doesn't match the assembly version. After these changes, I can build `xabuild` locally with MSBuild 17.3, and then also build Xamarin.Android projects.
1 parent f9dc964 commit 4873dfa

File tree

5 files changed

+17
-5
lines changed

5 files changed

+17
-5
lines changed

Directory.Build.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
<NuGetApiPackageVersion>5.4.0</NuGetApiPackageVersion>
5050
<LZ4PackageVersion>1.1.11</LZ4PackageVersion>
5151
<MonoOptionsVersion>6.12.0.148</MonoOptionsVersion>
52-
<SystemCollectionsImmutableVersion>1.7.1</SystemCollectionsImmutableVersion>
52+
<SystemCollectionsImmutableVersion>6.0.0</SystemCollectionsImmutableVersion>
53+
<SystemRuntimeCompilerServicesUnsafeVersion>6.0.0</SystemRuntimeCompilerServicesUnsafeVersion>
5354
<ELFSharpVersion>2.13.1</ELFSharpVersion>
5455
<MdocPackageVersion Condition=" '$(MdocPackageVersion)' == '' ">5.8.9.2</MdocPackageVersion>
5556
</PropertyGroup>

build-tools/xaprepare/xaprepare/Steps/Step_DetermineAzurePipelinesTestJobs.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ protected override async Task<bool> Execute (Context context)
149149
testAreas.Add ("MSBuildDevice");
150150
}
151151

152+
if (file.Contains ("tools/xabuild")) {
153+
testAreas.Add ("MSBuild");
154+
testAreas.Add ("MSBuildDevice");
155+
}
152156
}
153157

154158
Log.MessageLine ($"##vso[task.setvariable variable=TestAreas;isOutput=true]{string.Join (",", testAreas)}");

tools/decompress-assemblies/decompress-assemblies.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
<ItemGroup>
2424
<PackageReference Include="System.Collections.Immutable" Version="$(SystemCollectionsImmutableVersion)" />
25-
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.7.1" />
25+
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="$(SystemRuntimeCompilerServicesUnsafeVersion)" />
2626
<PackageReference Include="Xamarin.LibZipSharp" Version="$(LibZipSharpVersion)" />
2727
<PackageReference Include="K4os.Compression.LZ4" Version="$(LZ4PackageVersion)" />
2828
</ItemGroup>

tools/xabuild/App.config

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@
3939
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
4040
<dependentAssembly>
4141
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
42-
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="1.2.5.0" />
42+
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="6.0.0.0" />
43+
</dependentAssembly>
44+
</assemblyBinding>
45+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
46+
<dependentAssembly>
47+
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
48+
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="4.0.1.2" />
4349
</dependentAssembly>
4450
</assemblyBinding>
4551
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
@@ -51,7 +57,7 @@
5157
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
5258
<dependentAssembly>
5359
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
54-
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="4.0.6.0" />
60+
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="6.0.0.0" />
5561
</dependentAssembly>
5662
</assemblyBinding>
5763
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

tools/xabuild/xabuild.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
<Import Project="..\..\Configuration.props" />
1616
<ItemGroup>
1717
<PackageReference Include="System.Buffers" Version="4.5.1" />
18+
<PackageReference Include="System.Memory" Version="4.5.5" />
1819
<PackageReference Include="System.Collections.Immutable" Version="$(SystemCollectionsImmutableVersion)" />
1920
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
20-
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.7.1" />
21+
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="$(SystemRuntimeCompilerServicesUnsafeVersion)" />
2122
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
2223
<Reference Include="MSBuild">
2324
<HintPath>$(MSBuildToolsPath)\MSBuild.$(_MSBuildExtension)</HintPath>

0 commit comments

Comments
 (0)