Skip to content

Commit 9f56dec

Browse files
Move from netcoreapp3.1 to net6.0 (#195)
I believe this is a good idea anyway, but this should assist with: dotnet/android#7451 Which is hitting the error: error NU1102: Unable to find package Microsoft.NETCore.App.Host.osx-x64 with version (= 3.1.31) .NET Core 3.1.31 is not released yet and is likely on a private feed. Also pass `6.0.x` to the [`UseDotNet`][0] yaml task. After these changes, the build failed with: error MSB3971: The reference assemblies for ".NETFramework,Version=v6.0" were not found. You might be using an older .NET SDK to target .NET 5.0 or higher. Update Visual Studio and/or your .NET SDK. Mono MSBuild probably can't build .NET 6 projects? So I fixed various things in the build: * Use `dotnet build` instead of MSBuild, remove NuGet commands * No tests were running: [warning] Project file(s) matching the specified pattern were not found. * Fixed the `$(XATBuildingForNetCoreApp)` property, so tests run. * Upload artifacts based on the pool name: `$(vmImage)` * Use `$(PackageOutputPath)` instead of `$(OutputPath)` * `PublishBuildArtifacts` is deprecated use `PublishPipelineArtifact` * Save `.binlog` files as artifacts [0]: https://learn.microsoft.com/azure/devops/pipelines/tasks/tool/dotnet-core-tool-installer
1 parent 0be567a commit 9f56dec

File tree

7 files changed

+13
-29
lines changed

7 files changed

+13
-29
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<PropertyGroup>
1616
<BaseIntermediateOutputPath Condition=" '$(BaseIntermediateOutputPath)' == '' ">obj\</BaseIntermediateOutputPath>
1717
</PropertyGroup>
18-
<PropertyGroup Condition=" '$(TargetFramework)' != '' And $(TargetFramework.StartsWith ('netcoreapp')) ">
18+
<PropertyGroup Condition=" '$(TargetFramework)' != '' and '$(TargetFramework)' != 'net472' and '$(TargetFramework)' != 'netstandard2.0' ">
1919
<XATBuildingForNetCoreApp>True</XATBuildingForNetCoreApp>
2020
</PropertyGroup>
2121
<PropertyGroup Condition=" '$(XATBuildingForNetCoreApp)' == 'True' ">

azure-pipelines.yaml

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pr:
1212

1313
# Global variables
1414
variables:
15-
DotNetCoreVersion: 3.1.100
15+
DotNetCoreVersion: 6.0.x
1616

1717
jobs:
1818
- job: build
@@ -42,22 +42,8 @@ jobs:
4242
inputs:
4343
version: $(DotNetCoreVersion)
4444

45-
- task: NuGetToolInstaller@0
46-
displayName: 'Install NuGet'
47-
inputs:
48-
versionSpec: 5.x
49-
50-
- task: NuGetCommand@2
51-
displayName: 'NuGet Restore'
52-
inputs:
53-
restoreSolution: Xamarin.Android.Tools.sln
54-
feedsToUse: config
55-
nugetConfigPath: NuGet.config
56-
57-
- task: MSBuild@1
45+
- script: dotnet build Xamarin.Android.Tools.sln -bl:$(Build.ArtifactStagingDirectory)/build.binlog
5846
displayName: 'Build solution Xamarin.Android.Tools.sln'
59-
inputs:
60-
solution: Xamarin.Android.Tools.sln
6147

6248
- task: DotNetCoreCLI@2
6349
displayName: 'Run Tests'
@@ -73,15 +59,13 @@ jobs:
7359
Write-Host "##vso[task.setvariable variable=xat.nuget.version]$version"
7460
condition: and(succeeded(), eq(variables['agent.os'], 'Windows_NT'))
7561
76-
- task: MSBuild@1
62+
- script: dotnet pack src/Xamarin.Android.Tools.AndroidSdk/Xamarin.Android.Tools.AndroidSdk.csproj -p:Version=$(xat.nuget.version) -p:PackageOutputPath=$(Build.ArtifactStagingDirectory) -bl:$(Build.ArtifactStagingDirectory)/pack.binlog
7763
displayName: 'Build NuGet'
78-
inputs:
79-
solution: 'src\Xamarin.Android.Tools.AndroidSdk\Xamarin.Android.Tools.AndroidSdk.csproj'
80-
msbuildArguments: '/t:pack /p:Version=$(xat.nuget.version) /p:OutputPath=$(Build.ArtifactStagingDirectory)'
8164
condition: and(succeeded(), eq(variables['agent.os'], 'Windows_NT'))
8265

83-
- task: PublishBuildArtifacts@1
66+
- task: PublishPipelineArtifact@1
8467
displayName: Upload Artifacts
8568
inputs:
86-
pathtoPublish: $(Build.ArtifactStagingDirectory)
87-
condition: and(succeeded(), eq(variables['agent.os'], 'Windows_NT'))
69+
path: $(Build.ArtifactStagingDirectory)
70+
artifactName: $(vmImage)
71+
condition: always()

src/Microsoft.Android.Build.BaseTasks/Microsoft.Android.Build.BaseTasks.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<Import Project="MSBuildReferences.projitems" />
44

55
<PropertyGroup>
6-
<TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>
6+
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
77
<RootNamespace>Microsoft.Android.Build.Tasks</RootNamespace>
88
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
99
<SignAssembly>true</SignAssembly>

src/Xamarin.Android.Tools.AndroidSdk/Xamarin.Android.Tools.AndroidSdk.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>
4+
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
55
<LangVersion>8.0</LangVersion>
66
<Nullable>enable</Nullable>
77
<DefineConstants>INTERNAL_NULLABLE_ATTRIBUTES</DefineConstants>

tests/Microsoft.Android.Build.BaseTasks-Tests/Microsoft.Android.Build.BaseTasks-Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<!-- $(TargetFrameworks) is used to allow the $(TargetFramework) check in Directory.Build.props to work.
55
If $(TargetFramework) is declared here instead, it will not be evaluated before Directory.Build.props
66
is loaded and the wrong $(TestOutputFullPath) will be used. -->
7-
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
7+
<TargetFrameworks>net6.0</TargetFrameworks>
88
<RootNamespace>Microsoft.Android.Build.BaseTasks.Tests</RootNamespace>
99
<IsPackable>false</IsPackable>
1010
<OutputPath>$(TestOutputFullPath)</OutputPath>

tests/Xamarin.Android.Tools.AndroidSdk-Tests/Xamarin.Android.Tools.AndroidSdk-Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<!-- $(TargetFrameworks) is used to allow the $(TargetFramework) check in Directory.Build.props to work.
55
If $(TargetFramework) is declared here instead, it will not be evaluated before Directory.Build.props
66
is loaded and the wrong $(TestOutputFullPath) will be used. -->
7-
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
7+
<TargetFrameworks>net6.0</TargetFrameworks>
88
<SignAssembly>true</SignAssembly>
99
<AssemblyOriginatorKeyFile>..\..\product.snk</AssemblyOriginatorKeyFile>
1010
<IsPackable>false</IsPackable>

tools/ls-jdks/ls-jdks.csproj

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

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
5+
<TargetFrameworks>net472;net6.0</TargetFrameworks>
66
<RootNamespace>Xamarin.Android.Tools</RootNamespace>
77
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
88
<OutputPath>$(ToolOutputFullPath)</OutputPath>

0 commit comments

Comments
 (0)