Skip to content

Commit

Permalink
Update build to use .NET SDK 8 and C# 12
Browse files Browse the repository at this point in the history
  • Loading branch information
bradwilson committed Jan 15, 2024
1 parent 3cb1ad2 commit edf51bc
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/.global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sdk": {
"version": "8.0.100",
"rollForward": "latestMinor"
}
}
6 changes: 5 additions & 1 deletion .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@ jobs:
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1

- name: Replace global.json
run: cp .github/workflows/.global.json global.json
shell: bash

- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Get .NET information
run: dotnet --info
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/push-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@ jobs:
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1

- name: Replace global.json
run: cp .github/workflows/.global.json global.json
shell: bash

- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Get .NET information
run: dotnet --info
Expand Down
2 changes: 1 addition & 1 deletion Directory.build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Copyright>Copyright (c) .NET Foundation and Contributors.</Copyright>
<DebugType>embedded</DebugType>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<LangVersion>latest</LangVersion>
<LangVersion>12.0</LangVersion>
<MSBuildCopyContentTransitively>false</MSBuildCopyContentTransitively>
<PackageIcon>logo-512-transparent.png</PackageIcon>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
4 changes: 2 additions & 2 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ if ($null -eq (Get-Command "dotnet" -ErrorAction Ignore)) {
}

$version = [Version]$([regex]::matches((&dotnet --version), '^(\d+\.)?(\d+\.)?(\*|\d+)').value)
if ($version.Major -lt 7) {
throw ".NET SDK version ($version) is too low; please install version 7.0 or later"
if ($version.Major -lt 8) {
throw ".NET SDK version ($version) is too low; please install version 8.0 or later"
}

if ($null -eq (Get-Command "msbuild.exe" -ErrorAction Ignore)) {
Expand Down
2 changes: 1 addition & 1 deletion test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>portable</DebugType>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
<LangVersion>latest</LangVersion>
<LangVersion>12.0</LangVersion>
<PackageId>$(MSBuildProjectName)</PackageId>
<VersionPrefix>99.99.99-dev</VersionPrefix>
<WarningsAsErrors>true</WarningsAsErrors>
Expand Down
3 changes: 1 addition & 2 deletions tools/builder/build.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<LangVersion>10.0</LangVersion>
<NoWarn>$(NoWarn);CS8002</NoWarn>
<Nullable>enable</Nullable>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

Expand Down

0 comments on commit edf51bc

Please sign in to comment.