Skip to content

Commit

Permalink
Upgrade DataGateway Solution to .Net 6 (#164)
Browse files Browse the repository at this point in the history
* Update Solution to .Net 6

* Dedupe Functions Csproj config for function version.

* update build CI config to windows-latest which include latest vs2022 and .net6 SDK

* Update to windows-2022. windows-latest is not there yet.

* Configure build pipeline for ubuntu-latest

* Update VmImage to windows-2022 as windows-latest does not have .net6

* update Cosmos pipeline to use windows-2022

* Dockerfile set dotnet version to 6.0

* Remove custom install dotnet format tool build step as it is included in .NET6

* Update dependencies

* dotnet/format#1519 is fixed so unpinning sdk version

* adding dotnet tool installer task

Co-authored-by: Aaron Powell <me@aaron-powell.com>
  • Loading branch information
seantleonard and aaronpowell authored Apr 20, 2022
1 parent b4300ca commit d802b41
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .pipelines/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ trigger:
variables:
# DebugArguments: ' --filter "TestCategory!=ABC" --verbosity normal '
# ReleaseArguments: ' --filter "TestCategory!=ABC" --verbosity normal '
VmImage: windows-2019 # https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops
VmImage: windows-2022 # https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops

jobs:
- template: templates/static-tools.yml
Expand Down
12 changes: 6 additions & 6 deletions .pipelines/build-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ trigger:
- main

pool:
vmImage: 'ubuntu-18.04' # examples of other options: 'macOS-10.15', 'windows-2019'
vmImage: 'ubuntu-latest' # examples of other options: 'macOS-10.15', 'windows-2019'

variables:
solution: '**/*.sln'
Expand All @@ -21,12 +21,12 @@ steps:
inputs:
restoreSolution: '$(solution)'

- task: DotNetCoreCLI@2
displayName: Install dotnet format
- task: UseDotNet@2
displayName: Setup .NET SDK v6.0.x
inputs:
command: custom
custom: tool
arguments: 'restore'
packageType: sdk
version: 6.0.x
installationPath: $(Agent.ToolsDirectory)/dotnet

- task: DotNetCoreCLI@2
displayName: Check formatting
Expand Down
7 changes: 6 additions & 1 deletion .pipelines/cosmos-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ strategy:
imageName: "macOS-latest"
ADDITIONAL_TEST_ARGS: ''
windows:
imageName: "windows-latest"
imageName: "windows-2022"
ADDITIONAL_TEST_ARGS: '--collect "XPlat Code coverage"'
maxParallel: 3
pool:
Expand All @@ -23,6 +23,11 @@ variables:
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: UseDotNet@2
displayName: Setup .NET SDK v6.0.x
inputs:
packageType: sdk
version: 6.0.x
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
displayName: Restore NuGet packages
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>

<IsPackable>false</IsPackable>

Expand All @@ -11,11 +11,11 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="5.0.15" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="5.0.15" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.6" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.6" />
<PackageReference Include="coverlet.collector" Version="3.0.2">
<PackageReference Include="coverlet.collector" Version="3.1.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion DataGateway.Service/Azure.DataGateway.Service.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Configurations>Debug;Release;Docker</Configurations>
</PropertyGroup>

Expand Down
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
# Build and copy GraphQL binaries and run them.
#

FROM mcr.microsoft.com/dotnet/sdk:5.0 as build
# Version values referenced from https://hub.docker.com/_/microsoft-dotnet-aspnet
FROM mcr.microsoft.com/dotnet/sdk:6.0 as build

COPY ["Directory.Build.props", "."]
WORKDIR /src

COPY ["DataGateway.Service/", "./"]
RUN dotnet build "./Azure.DataGateway.Service.csproj" -c Docker -o /out -r linux-x64

FROM mcr.microsoft.com/dotnet/aspnet:5.0 as runtime
FROM mcr.microsoft.com/dotnet/aspnet:6.0 as runtime

COPY --from=build /out /App
WORKDIR /App
Expand Down

0 comments on commit d802b41

Please sign in to comment.