Skip to content

Commit fd12f85

Browse files
[Microsoft.Android.Sdk] use net5.0-android $(TargetFramework)
After bumping to .NET 5.0.100-rc.1.20411.10, we can now use: <TargetFramework>net5.0-android</TargetFramework> On the first try, this failed with: Microsoft.NET.TargetFrameworkInference.targets(113,5): error NETSDK1139: The target platform identifier android was not recognized. Our SDK needs to specify: <TargetPlatformSupported Condition=" '$(TargetPlatformIdentifier)' == 'Android' ">true</TargetPlatformSupported> After doing this, everything seemed to work as before. I updated tests so they will use `net5.0-android` going forward.
1 parent adcad50 commit fd12f85

File tree

5 files changed

+5
-4
lines changed

5 files changed

+5
-4
lines changed

Documentation/guides/OneDotNet.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ The following instructions can be used for early preview testing.
206206
```xml
207207
<Project Sdk="Microsoft.Android.Sdk/10.0.100">
208208
<PropertyGroup>
209-
<TargetFramework>net5.0</TargetFramework>
209+
<TargetFramework>net5.0-android</TargetFramework>
210210
<RuntimeIdentifier>android.21-arm64</RuntimeIdentifier>
211211
<OutputType>Exe</OutputType>
212212
</PropertyGroup>

build-tools/automation/azure-pipelines.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ variables:
5252
NUnitConsoleVersion: 3.11.1
5353
DotNetCoreVersion: 3.1.201
5454
# Version number from: https://github.com/dotnet/installer#installers-and-binaries
55-
DotNetCorePreviewVersion: 5.0.100-preview.7.20307.3
55+
DotNetCorePreviewVersion: 5.0.100-rc.1.20411.10
5656
HostedMacMojave: Hosted Mac Internal Mojave
5757
HostedMac: Hosted Mac Internal
5858
HostedWinVS2019: Hosted Windows 2019 with VS2019

src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
22

33
<PropertyGroup>
4+
<TargetPlatformSupported Condition=" '$(TargetPlatformIdentifier)' == 'Android' ">true</TargetPlatformSupported>
45
<MicrosoftAndroidSdkTargetsImported>true</MicrosoftAndroidSdkTargetsImported>
56
<_XamarinAndroidBuildTasksAssembly>$(MSBuildThisFileDirectory)..\tools\Xamarin.Android.Build.Tasks.dll</_XamarinAndroidBuildTasksAssembly>
67
</PropertyGroup>

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Android/XASdkProject.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ static XASdkProject ()
4848
public XASdkProject (string outputType = "Exe")
4949
{
5050
Sdk = $"Microsoft.Android.Sdk/{SdkVersion}";
51-
TargetFramework = "net5.0";
51+
TargetFramework = "net5.0-android";
5252

5353
TargetSdkVersion = AndroidSdkResolver.GetMaxInstalledPlatform ().ToString ();
5454
PackageName = PackageName ?? string.Format ("{0}.{0}", ProjectName);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ protected DotNetXamarinProject (string debugConfigurationName = "Debug", string
2626
SetProperty ("AssemblyName", () => AssemblyName ?? ProjectName);
2727

2828
if (Builder.UseDotNet) {
29-
SetProperty ("TargetFramework", "net5.0");
29+
SetProperty ("TargetFramework", "net5.0-android");
3030
SetProperty ("EnableDefaultItems", "false");
3131
SetProperty ("AppendTargetFrameworkToOutputPath", "false");
3232
SetProperty ("AppendRuntimeIdentifierToOutputPath", "false");

0 commit comments

Comments
 (0)