Skip to content

Commit ea5313c

Browse files
[build] update binding redirects for MSBuild 17.3
`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 VS 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 328644a commit ea5313c

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

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: 3 additions & 2 deletions
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.Collections.Immutable" Version="$(SystemCollectionsImmutableVersion)" />
18+
<PackageReference Include="System.Memory" Version="4.5.5" />
19+
<PackageReference Include="System.Collections.Immutable" Version="6.0.0" />
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="6.0.0" />
2122
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
2223
<Reference Include="MSBuild">
2324
<HintPath>$(MSBuildToolsPath)\MSBuild.$(_MSBuildExtension)</HintPath>

0 commit comments

Comments
 (0)