diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index a03d9e1..2bd286a 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -38,7 +38,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
- dotnet-version: 6.0.x
+ dotnet-version: 8.0.x
# Adjustment is done prior to Nuke build as OCTOVERSION information is included in the result package.
- name: Append OCTOVERSION_CurrentBranch with -nightly (for scheduled)
diff --git a/build/Build.cs b/build/Build.cs
index 2231014..bba0bfe 100644
--- a/build/Build.cs
+++ b/build/Build.cs
@@ -1,7 +1,5 @@
using System;
-using System.Linq;
using Nuke.Common;
-using Nuke.Common.CI;
using Nuke.Common.Execution;
using Nuke.Common.IO;
using Nuke.Common.ProjectModel;
@@ -10,8 +8,8 @@
using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.Tools.DotNet.DotNetTasks;
using Nuke.Common.Tools.OctoVersion;
+using Serilog;
-[CheckBuildProjectConfigurations]
[UnsetVisualStudioEnvironmentVariables]
class Build : NukeBuild
{
@@ -19,29 +17,30 @@ class Build : NukeBuild
readonly Configuration Configuration = Configuration.Release;
- [Solution] readonly Solution Solution;
+ [Solution] readonly Solution Solution = null!; // assigned by Nuke via reflection
[Parameter] readonly bool? OctoVersionAutoDetectBranch = NukeBuild.IsLocalBuild;
+#pragma warning disable CS0414 // Field assigned but never used
[Parameter("Branch name for OctoVersion to use to calculate the version number. Can be set via the environment variable " + CiBranchNameEnvVariable + ".", Name = CiBranchNameEnvVariable)]
- readonly string OctoVersionBranch;
+ readonly string OctoVersionBranch = null!; // assigned by Nuke via reflection
+#pragma warning restore CS0414
- [Parameter] readonly int? OctoVersionFullSemVer;
+ [Parameter] readonly string? OctoVersionFullSemVer;
[Parameter] readonly int? OctoVersionMajor;
[Parameter] readonly int? OctoVersionMinor;
[Parameter] readonly int? OctoVersionPatch;
[Required]
[OctoVersion(
- AutoDetectBranchParameter = nameof(OctoVersionAutoDetectBranch),
- BranchParameter = nameof(OctoVersionBranch),
- FullSemVerParameter = nameof(OctoVersionFullSemVer),
- MajorParameter = nameof(OctoVersionMajor),
- MinorParameter = nameof(OctoVersionMinor),
- PatchParameter = nameof(OctoVersionPatch),
- Framework = "net6.0")]
-
- readonly OctoVersionInfo OctoVersionInfo;
+ AutoDetectBranchMember = nameof(OctoVersionAutoDetectBranch),
+ BranchMember = nameof(OctoVersionBranch),
+ FullSemVerMember = nameof(OctoVersionFullSemVer),
+ MajorMember = nameof(OctoVersionMajor),
+ MinorMember = nameof(OctoVersionMinor),
+ PatchMember = nameof(OctoVersionPatch),
+ Framework = "net8.0")]
+ readonly OctoVersionInfo OctoVersionInfo = null!; // assigned by Nuke via reflection
static AbsolutePath SourceDirectory => RootDirectory / "source";
static AbsolutePath ArtifactsDirectory => RootDirectory / "artifacts";
@@ -52,9 +51,9 @@ class Build : NukeBuild
.Before(Restore)
.Executes(() =>
{
- SourceDirectory.GlobDirectories("**/bin", "**/obj", "**/TestResults").ForEach(DeleteDirectory);
- EnsureCleanDirectory(ArtifactsDirectory);
- EnsureCleanDirectory(PublishDirectory);
+ SourceDirectory.GlobDirectories("**/bin", "**/obj", "**/TestResults").ForEach(x => x.DeleteDirectory());
+ ArtifactsDirectory.CreateOrCleanDirectory();
+ PublishDirectory.CreateOrCleanDirectory();
});
Target Restore => _ => _
@@ -70,7 +69,7 @@ class Build : NukeBuild
.DependsOn(Restore)
.Executes(() =>
{
- Logger.Info("Building Octopus Versioning v{0}", OctoVersionInfo.FullSemVer);
+ Log.Information("Building Octopus Versioning v{0}", OctoVersionInfo.FullSemVer);
DotNetBuild(_ => _
.SetProjectFile(Solution)
@@ -96,7 +95,7 @@ class Build : NukeBuild
.Produces(ArtifactsDirectory / "*.nupkg")
.Executes(() =>
{
- Logger.Info("Packing Octopus Versioning v{0}", OctoVersionInfo.FullSemVer);
+ Log.Information("Packing Octopus Versioning v{0}", OctoVersionInfo.FullSemVer);
// This is done to pass the data to github actions
Console.Out.WriteLine($"::set-output name=semver::{OctoVersionInfo.FullSemVer}");
@@ -118,7 +117,7 @@ class Build : NukeBuild
.TriggeredBy(Pack)
.Executes(() =>
{
- EnsureExistingDirectory(LocalPackagesDir);
+ LocalPackagesDir.CreateDirectory();
ArtifactsDirectory.GlobFiles("*.nupkg")
.ForEach(package =>
{
diff --git a/build/_build.csproj b/build/_build.csproj
index ce42605..1a22a74 100644
--- a/build/_build.csproj
+++ b/build/_build.csproj
@@ -2,20 +2,23 @@
Exe
- net6.0
+ net8.0
CS0649;CS0169
..
..
1
+
+ true
+ enable
-
+
-
+
diff --git a/source/Octopus.Versioning.Tests/Octopus.Versioning.Tests.csproj b/source/Octopus.Versioning.Tests/Octopus.Versioning.Tests.csproj
index 1782574..0e96278 100644
--- a/source/Octopus.Versioning.Tests/Octopus.Versioning.Tests.csproj
+++ b/source/Octopus.Versioning.Tests/Octopus.Versioning.Tests.csproj
@@ -1,6 +1,6 @@
- net6.0
+ net8.0
Octopus.Versioning.Tests
Octopus.Versioning.Tests
http://i.octopusdeploy.com/resources/Avatar3_360.png