Skip to content

Commit

Permalink
Update to NET 8 SDK (#1647)
Browse files Browse the repository at this point in the history
* tests and samples target NET8.0
* use artifacts output
* move .props to root level
  • Loading branch information
lahma committed Nov 28, 2023
1 parent 5496a20 commit bb1b7ae
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 207 deletions.
3 changes: 3 additions & 0 deletions src/Directory.Build.props → Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
<LangVersion>latest</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Nullable>enable</Nullable>

<UseArtifactsOutput>true</UseArtifactsOutput>

</PropertyGroup>

</Project>
File renamed without changes.
4 changes: 2 additions & 2 deletions build/Build.CI.GitHubActions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Nuke.Common.CI.GitHubActions;

[GitHubActionsAttribute(
[GitHubActions(
"pr",
GitHubActionsImage.WindowsLatest,
GitHubActionsImage.UbuntuLatest,
Expand All @@ -11,7 +11,7 @@
InvokedTargets = new[] { nameof(Compile), nameof(Test), nameof(Pack) },
CacheKeyFiles = new[] { "global.json", "src/**/*.csproj", "src/**/package.json" }),
]
[GitHubActionsAttribute(
[GitHubActions(
"build",
GitHubActionsImage.WindowsLatest,
GitHubActionsImage.UbuntuLatest,
Expand Down
4 changes: 2 additions & 2 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ string DetermineVersionPrefix()
}
else
{
var propsDocument = XDocument.Parse((SourceDirectory / "Directory.Build.props").ReadAllText());
var propsDocument = XDocument.Parse((RootDirectory / "Directory.Build.props").ReadAllText());
versionPrefix = propsDocument.Element("Project").Element("PropertyGroup").Element("VersionPrefix").Value;
Serilog.Log.Information("Version prefix {VersionPrefix} read from Directory.Build.props", versionPrefix);
}
Expand Down Expand Up @@ -128,7 +128,7 @@ protected override void OnBuildInitialized()
var framework = "";
if (!IsRunningOnWindows)
{
framework = "net6.0";
framework = "net8.0";
}
DotNetTest(s => s
Expand Down
8 changes: 7 additions & 1 deletion build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace></RootNamespace>
<NoWarn>CS0649;CS0169</NoWarn>
<NukeRootDirectory>..</NukeRootDirectory>
<NukeScriptDirectory>..</NukeScriptDirectory>
<NukeTelemetryVersion>1</NukeTelemetryVersion>
<IsPackable>false</IsPackable>
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
<UseArtifactsOutput>false</UseArtifactsOutput>
<NukeExcludeConfig>true</NukeExcludeConfig>
<NukeExcludeDirectoryBuild>true</NukeExcludeDirectoryBuild>
<NukeExcludeLogs>true</NukeExcludeLogs>
</PropertyGroup>

<ItemGroup>
Expand Down
6 changes: 6 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sdk": {
"version": "8.0.100",
"rollForward": "latestMinor"
}
}
2 changes: 1 addition & 1 deletion src/NJsonSchema.Benchmark/NJsonSchema.Benchmark.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<GenerateProgramFile>false</GenerateProgramFile>
<NoWarn>$(NoWarn),xUnit1013</NoWarn>
<SignAssembly>false</SignAssembly>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn),1587,1998,1591,618,SYSLIB0012</NoWarn>
Expand All @@ -16,8 +16,8 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Condition="'$(TargetFramework)' == 'net6.0'" />
<PackageReference Condition="'$(TargetFramework)' == 'net6.0'" Include="System.ComponentModel.Annotations" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Condition="'$(TargetFramework)' == 'net8.0'" />
<PackageReference Condition="'$(TargetFramework)' == 'net8.0'" Include="System.ComponentModel.Annotations" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net462</TargetFrameworks>
<TargetFrameworks>net8.0;net462</TargetFrameworks>
<IsPackable>false</IsPackable>
<NoWarn>$(NoWarn),1998,1591,618</NoWarn>
<Nullable>disable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Condition="'$(TargetFramework)' == 'net462'" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Condition="'$(TargetFramework)' == 'net6.0'" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Condition="'$(TargetFramework)' == 'net8.0'" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net462</TargetFrameworks>
<TargetFrameworks>net8.0;net462</TargetFrameworks>
<IsPackable>false</IsPackable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn),1587,1998,1591,618</NoWarn>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/NJsonSchema.Demo/NJsonSchema.Demo.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<GenerateProgramFile>true</GenerateProgramFile>
<ApplicationIcon />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net462</TargetFrameworks>
<TargetFrameworks>net8.0;net462</TargetFrameworks>
<IsPackable>false</IsPackable>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<Nullable>disable</Nullable>
Expand Down
2 changes: 1 addition & 1 deletion src/NJsonSchema.Tests/NJsonSchema.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net7.0;net462</TargetFrameworks>
<TargetFrameworks>net8.0;net462</TargetFrameworks>
<IsPackable>false</IsPackable>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<Nullable>disable</Nullable>
Expand Down
2 changes: 1 addition & 1 deletion src/NJsonSchema.Yaml.Tests/NJsonSchema.Yaml.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net462</TargetFrameworks>
<TargetFrameworks>net8.0;net462</TargetFrameworks>
<IsPackable>false</IsPackable>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<Nullable>disable</Nullable>
Expand Down

0 comments on commit bb1b7ae

Please sign in to comment.