Skip to content

Commit a45f84d

Browse files
authored
[build] Use Mono with MSBuild 16.10 (#6014)
Changes: xamarin/monodroid@1f2ce15...3653600 * xamarin/monodroid@d111a7a: [tools/msbuild] Add additional fallbacks to GetPrimaryCpuAbi. * xamarin/monodroid@3653600: Bump to xamarin/androidtools@14e679e and ee49249 Changes: dotnet/android-tools@49936d6...c055fa8 * dotnet/android-tools@c055fa8: [Microsoft.Android.Build] Bump to MSBuild 16.10.0 We've been seeing a NuGet restore issue when running prepare on a macOS system with .NET 6 Preview 4 (or greater) installed: Restoring packages for /Users/peter/source/java.interop/tools/logcat-parse/logcat-parse.csproj... NU1202: Package Mono.CSharp 4.0.0.143 is not compatible with net6.0 (.NETCoreApp,Version=v6.0). Package Mono.CSharp 4.0.0.143 supports: net45 (.NETFramework,Version=v4.5) ... Errors in /Users/peter/source/java.interop/tools/logcat-parse/logcat-parse.csproj NU1202: Package Mono.CSharp 4.0.0.143 is not compatible with net6.0 (.NETCoreApp,Version=v6.0). Package Mono.CSharp 4.0.0.143 supports: net45 (.NETFramework,Version=v4.5) I have encountered other issues with .NET 6 Preview 4 and greater when building some projects targeting net6.0: Version 'x' of the .NET Core SDK requires at least version 16.10.0 of MSBuild. The current available version of MSBuild is 16.9.0. Change the .NET Core SDK specified in global.json to an older version that requires the MSBuild version currently available. These issues should be addressed by using MSBuild 16.10 on macOS.
1 parent 1fb3c82 commit a45f84d

File tree

8 files changed

+29
-8
lines changed

8 files changed

+29
-8
lines changed

.external

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
xamarin/monodroid:main@1f2ce156245ef1bf63ec8014882d283b3224216b
1+
xamarin/monodroid:main@36536006a74d9fa9b08b14301f73b2e7da93d75d
22
mono/mono:2020-02@c633fe923832f0c3db3c4e6aa98e5592bf5a06e7

Configuration.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@
9393
<AndroidSupportedTargetJitAbis Condition=" '$(AndroidSupportedTargetJitAbis)' == '' ">armeabi-v7a:arm64-v8a:x86:x86_64</AndroidSupportedTargetJitAbis>
9494
<JavaInteropSourceDirectory Condition=" '$(JavaInteropSourceDirectory)' == '' ">$(MSBuildThisFileDirectory)external\Java.Interop</JavaInteropSourceDirectory>
9595
<MonoSourceDirectory>$(MSBuildThisFileDirectory)external\mono</MonoSourceDirectory>
96-
<MonoDarwinPackageUrl>https://xamjenkinsartifact.azureedge.net/build-package-osx-mono/2020-02/144/b4a385816ed4f1398d0184c38f19f560e868fd80/MonoFramework-MDK-6.12.0.137.macos10.xamarin.universal.pkg</MonoDarwinPackageUrl>
97-
<MonoRequiredMinimumVersion Condition=" '$(MonoRequiredMinimumVersion)' == '' ">6.12.0.137</MonoRequiredMinimumVersion>
96+
<MonoDarwinPackageUrl>https://xamjenkinsartifact.azureedge.net/build-package-osx-mono/2020-02/151/c633fe923832f0c3db3c4e6aa98e5592bf5a06e7/MonoFramework-MDK-6.12.0.145.macos10.xamarin.universal.pkg</MonoDarwinPackageUrl>
97+
<MonoRequiredMinimumVersion Condition=" '$(MonoRequiredMinimumVersion)' == '' ">6.12.0.145</MonoRequiredMinimumVersion>
9898
<MonoRequiredMaximumVersion Condition=" '$(MonoRequiredMaximumVersion)' == '' ">$(MonoRequiredMinimumVersion)</MonoRequiredMaximumVersion>
9999
<IgnoreMaxMonoVersion Condition=" '$(IgnoreMaxMonoVersion)' == '' And '$(RunningOnCI)' == 'true' ">False</IgnoreMaxMonoVersion>
100100
<IgnoreMaxMonoVersion Condition=" '$(IgnoreMaxMonoVersion)' == '' ">True</IgnoreMaxMonoVersion>

external/xamarin-android-tools

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/App.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
1111
<dependentAssembly>
1212
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
13-
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="1.2.5.0" />
13+
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="5.0.0.0" />
1414
</dependentAssembly>
1515
</assemblyBinding>
1616
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
1717
<dependentAssembly>
1818
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
19-
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="4.0.6.0" />
19+
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="5.0.0.0" />
2020
</dependentAssembly>
2121
</assemblyBinding>
2222
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/Builder.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,11 @@ protected bool BuildInternal (string projectOrSolution, string target, string []
345345
psi.EnvironmentVariables ["ghprbPullLongDescription"] =
346346
psi.EnvironmentVariables ["BUILD_SOURCEVERSIONMESSAGE"] = "";
347347

348+
// Ensure any variable alteration from DotNetXamarinProject.Construct is cleared.
349+
if (!Builder.UseDotNet && !TestEnvironment.IsWindows) {
350+
psi.EnvironmentVariables ["MSBUILD_EXE_PATH"] = null;
351+
}
352+
348353
psi.Arguments = args.ToString ();
349354

350355
psi.CreateNoWindow = true;

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/DotNetCLI.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ protected bool Execute (params string [] args)
5353
p.StartInfo.UseShellExecute = false;
5454
p.StartInfo.RedirectStandardOutput = true;
5555
p.StartInfo.RedirectStandardError = true;
56+
// Ensure any variable alteration from DotNetXamarinProject.Construct is cleared.
57+
if (!Builder.UseDotNet && !TestEnvironment.IsWindows) {
58+
p.StartInfo.EnvironmentVariables ["MSBUILD_EXE_PATH"] = null;
59+
}
5660

5761
p.ErrorDataReceived += (sender, e) => {
5862
if (e.Data != null) {

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/DotNetXamarinProject.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,20 @@ public void AddSources (params string [] sources)
9494

9595
public virtual ProjectRootElement Construct ()
9696
{
97-
var root = ProjectRootElement.Create ();
97+
// Workaround for https://github.com/dotnet/msbuild/issues/2554 when using Microsoft.Build.Construction.ProjectRootElement.Create
98+
var msbuildExePathVarName = "MSBUILD_EXE_PATH";
99+
if (!Builder.UseDotNet && !TestEnvironment.IsWindows) {
100+
Environment.SetEnvironmentVariable (msbuildExePathVarName, typeof (DotNetXamarinProject).Assembly.Location);
101+
}
102+
ProjectRootElement root = null;
103+
try {
104+
root = ProjectRootElement.Create ();
105+
} finally {
106+
if (!Builder.UseDotNet && !TestEnvironment.IsWindows) {
107+
Environment.SetEnvironmentVariable (msbuildExePathVarName, null);
108+
}
109+
}
110+
98111
if (Packages.Any ())
99112
root.AddItemGroup ().AddItem (BuildActions.None, "packages.config");
100113
foreach (var pkg in Packages.Where (p => p.AutoAddReferences))

src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
<PackageReference Include="NuGet.Protocol" Version="$(NuGetApiPackageVersion)" />
5151
<PackageReference Include="NuGet.Versioning" Version="$(NuGetApiPackageVersion)" />
5252
<PackageReference Include="System.CodeDom" Version="4.7.0" />
53-
<PackageReference Include="System.Collections.Immutable" Version="$(SystemCollectionsImmutableVersion)" />
5453
<PackageReference Include="System.Reflection.Metadata" Version="1.8.0" />
5554
<PackageReference Include="System.Runtime" Version="4.3.1" />
5655
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />

0 commit comments

Comments
 (0)