From 5443838a720b1803dba51d4e673777c9d1005b7b Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Tue, 16 Aug 2022 20:26:46 -0500 Subject: [PATCH] [xabuild] 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. --- Directory.Build.props | 3 ++- .../Steps/Step_DetermineAzurePipelinesTestJobs.cs | 4 ++++ .../decompress-assemblies/decompress-assemblies.csproj | 2 +- tools/xabuild/App.config | 10 ++++++++-- tools/xabuild/xabuild.csproj | 3 ++- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 13a8c5069e7..a252e77801c 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -49,7 +49,8 @@ 5.4.0 1.1.11 6.12.0.148 - 1.7.1 + 6.0.0 + 6.0.0 2.13.1 5.8.9.2 diff --git a/build-tools/xaprepare/xaprepare/Steps/Step_DetermineAzurePipelinesTestJobs.cs b/build-tools/xaprepare/xaprepare/Steps/Step_DetermineAzurePipelinesTestJobs.cs index 1ba34a5cfbd..9c3496ec96c 100644 --- a/build-tools/xaprepare/xaprepare/Steps/Step_DetermineAzurePipelinesTestJobs.cs +++ b/build-tools/xaprepare/xaprepare/Steps/Step_DetermineAzurePipelinesTestJobs.cs @@ -149,6 +149,10 @@ protected override async Task Execute (Context context) testAreas.Add ("MSBuildDevice"); } + if (file.Contains ("tools/xabuild")) { + testAreas.Add ("MSBuild"); + testAreas.Add ("MSBuildDevice"); + } } Log.MessageLine ($"##vso[task.setvariable variable=TestAreas;isOutput=true]{string.Join (",", testAreas)}"); diff --git a/tools/decompress-assemblies/decompress-assemblies.csproj b/tools/decompress-assemblies/decompress-assemblies.csproj index a21f994bcc8..049031e704c 100644 --- a/tools/decompress-assemblies/decompress-assemblies.csproj +++ b/tools/decompress-assemblies/decompress-assemblies.csproj @@ -22,7 +22,7 @@ - + diff --git a/tools/xabuild/App.config b/tools/xabuild/App.config index 84da2ac4ceb..df79e5196a3 100644 --- a/tools/xabuild/App.config +++ b/tools/xabuild/App.config @@ -39,7 +39,13 @@ - + + + + + + + @@ -51,7 +57,7 @@ - + diff --git a/tools/xabuild/xabuild.csproj b/tools/xabuild/xabuild.csproj index 91314dd8e49..cfc40557a26 100644 --- a/tools/xabuild/xabuild.csproj +++ b/tools/xabuild/xabuild.csproj @@ -15,9 +15,10 @@ + - + $(MSBuildToolsPath)\MSBuild.$(_MSBuildExtension)