Skip to content

Commit bb09878

Browse files
Upgrade to dotnet6 and net462 (#52)
1 parent 0a82cac commit bb09878

13 files changed

Lines changed: 61 additions & 23 deletions

.config/dotnet-tools.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"nuke.globaltool": {
6+
"version": "6.0.2",
7+
"commands": [
8+
"nuke"
9+
]
10+
}
11+
}
12+
}

.nuke/build.schema.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
"build": {
77
"type": "object",
88
"properties": {
9+
"AutoDetectBranch": {
10+
"type": "boolean",
11+
"description": "Whether to auto-detect the branch name - this is okay for a local build, but should not be used under CI"
12+
},
913
"Configuration": {
1014
"type": "string",
1115
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
@@ -46,6 +50,10 @@
4650
"type": "boolean",
4751
"description": "Disables displaying the NUKE logo"
4852
},
53+
"OCTOVERSION_CurrentBranch": {
54+
"type": "string",
55+
"description": "Branch name for OctoVersion to use to calculate the version number. Can be set via the environment variable OCTOVERSION_CurrentBranch"
56+
},
4957
"Partition": {
5058
"type": "string",
5159
"description": "Partition to use on CI"

build.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ else {
6363
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe"
6464
}
6565

66-
Write-Output "Microsoft (R) .NET Core SDK version $(& $env:DOTNET_EXE --version)"
66+
Write-Output "Microsoft (R) .NET SDK version $(& $env:DOTNET_EXE --version)"
6767

6868
ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet }
6969
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments }

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ else
5656
export DOTNET_EXE="$DOTNET_DIRECTORY/dotnet"
5757
fi
5858

59-
echo "Microsoft (R) .NET Core SDK version $("$DOTNET_EXE" --version)"
59+
echo "Microsoft (R) .NET SDK version $("$DOTNET_EXE" --version)"
6060

6161
"$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet
6262
"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- "$@"

build/Build.cs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,19 @@
33
using System;
44
using System.IO;
55
using System.Linq;
6+
using JetBrains.Annotations;
67
using Nuke.Common;
78
using Nuke.Common.Execution;
89
using Nuke.Common.IO;
910
using Nuke.Common.ProjectModel;
1011
using Nuke.Common.Tooling;
1112
using Nuke.Common.Tools.DotNet;
1213
using Nuke.Common.Tools.ILRepack;
14+
using Nuke.Common.Tools.OctoVersion;
1315
using Nuke.Common.Utilities.Collections;
14-
using OctoVersion.Core;
16+
using Serilog;
1517
using static Nuke.Common.IO.FileSystemTasks;
1618
using static Nuke.Common.Tools.DotNet.DotNetTasks;
17-
using Nuke.OctoVersion;
1819

1920
[CheckBuildProjectConfigurations]
2021
[UnsetVisualStudioEnvironmentVariables]
@@ -24,8 +25,19 @@ class Build : NukeBuild
2425

2526
[Solution(GenerateProjects = true)] readonly Solution Solution;
2627

27-
[NukeOctoVersion] readonly OctoVersionInfo OctoVersionInfo;
28+
[Parameter(
29+
"Whether to auto-detect the branch name - this is okay for a local build, but should not be used under CI.")]
30+
readonly bool AutoDetectBranch = IsLocalBuild;
2831

32+
[Parameter(
33+
"Branch name for OctoVersion to use to calculate the version number. Can be set via the environment variable OCTOVERSION_CurrentBranch.",
34+
Name = "OCTOVERSION_CurrentBranch")]
35+
readonly string BranchName;
36+
37+
[OctoVersion(UpdateBuildNumber = true, BranchParameter = nameof(BranchName),
38+
AutoDetectBranchParameter = nameof(AutoDetectBranch), Framework = "net6.0")]
39+
readonly OctoVersionInfo OctoVersionInfo;
40+
2941
AbsolutePath SourceDirectory => RootDirectory / "source";
3042
AbsolutePath ArtifactsDirectory => RootDirectory / "artifacts";
3143
AbsolutePath LocalPackagesDirectory => RootDirectory / ".." / "LocalPackages";
@@ -39,10 +51,11 @@ class Build : NukeBuild
3951
EnsureCleanDirectory(ArtifactsDirectory);
4052
});
4153

54+
[PublicAPI]
4255
Target CalculateVersion => _ => _
4356
.Executes(() =>
4457
{
45-
//all the magic happens inside `[NukeOctoVersion]` above. we just need a target for TeamCity to call
58+
//all the magic happens inside `[OctoVersion]` above. we just need a target for TeamCity to call
4659
});
4760

4861
Target Restore => _ => _
@@ -58,7 +71,7 @@ class Build : NukeBuild
5871
.DependsOn(Restore)
5972
.Executes(() =>
6073
{
61-
Logger.Info("Building {0} v{1}", Solution.Name, OctoVersionInfo.FullSemVer);
74+
Log.Information("Building {0} v{1}", Solution.Name, OctoVersionInfo.FullSemVer);
6275

6376
DotNetBuild(_ => _
6477
.SetProjectFile(Solution)
@@ -144,6 +157,7 @@ class Build : NukeBuild
144157
}
145158
});
146159

160+
[UsedImplicitly]
147161
Target CopyToLocalPackages => _ => _
148162
.OnlyWhenStatic(() => IsLocalBuild)
149163
.TriggeredBy(Pack)

build/_build.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net5.0</TargetFramework>
5+
<TargetFramework>net6.0</TargetFramework>
66
<RootNamespace></RootNamespace>
77
<NoWarn>CS0649;CS0169</NoWarn>
88
<NukeRootDirectory>..</NukeRootDirectory>
@@ -11,9 +11,9 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Nuke.Common" Version="5.3.0" />
15-
<PackageReference Include="Nuke.OctoVersion" Version="0.2.438" />
14+
<PackageReference Include="Nuke.Common" Version="6.0.2" />
1615
<PackageReference Include="ILRepack" Version="2.0.18" />
16+
<PackageDownload Include="OctoVersion.Tool" Version="[0.2.1058]" />
1717
</ItemGroup>
1818

1919
</Project>

global.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "5.0.303",
3+
"version": "6.0.102",
44
"rollForward": "latestFeature"
55
}
6-
}
6+
}

source/CommandLine/CommandLine.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks Condition="!$([MSBuild]::IsOSUnixLike())">net452;netstandard2.0;netcoreapp3.1;net5.0</TargetFrameworks>
5-
<TargetFrameworks Condition="$([MSBuild]::IsOSUnixLike())">netstandard2.0;netcoreapp3.1;net5.0</TargetFrameworks>
4+
<TargetFrameworks Condition="!$([MSBuild]::IsOSUnixLike())">net462;netstandard2.0;netcoreapp3.1;net6.0</TargetFrameworks>
5+
<TargetFrameworks Condition="$([MSBuild]::IsOSUnixLike())">netstandard2.0;netcoreapp3.1;net6.0</TargetFrameworks>
66
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
77
<DebugType>embedded</DebugType>
88
<AssemblyName>Octopus.CommandLine</AssemblyName>

source/CommandLine/Octopus.CommandLine.nuspec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
<copyright>Copyright © Octopus Deploy 2021</copyright>
1515
<repository url="https://github.com/OctopusDeploy/CommandLine" />
1616
<dependencies>
17-
<group targetFramework=".NETFramework4.5.2">
17+
<group targetFramework=".NETFramework4.6.2">
1818
<dependency id="Serilog" version="2.3.0" exclude="Build,Analyzers" />
1919
</group>
2020
<group targetFramework=".NETCoreApp3.1">
2121
<dependency id="Serilog" version="2.3.0" exclude="Build,Analyzers" />
2222
</group>
23-
<group targetFramework="net5.0">
23+
<group targetFramework="net6.0">
2424
<dependency id="Serilog" version="2.3.0" exclude="Build,Analyzers" />
2525
</group>
2626
<group targetFramework=".NETStandard2.0">
@@ -30,8 +30,8 @@
3030
</metadata>
3131
<files>
3232
<file src="icon.png" target="images\" />
33-
<file src="bin\$configuration$\net452\Octopus.CommandLine.dll" target="lib\net452" />
34-
<file src="bin\$configuration$\net5.0\Octopus.CommandLine.dll" target="lib\net5.0" />
33+
<file src="bin\$configuration$\net462\Octopus.CommandLine.dll" target="lib\net462" />
34+
<file src="bin\$configuration$\net6.0\Octopus.CommandLine.dll" target="lib\net6.0" />
3535
<file src="bin\$configuration$\netcoreapp3.1\Octopus.CommandLine.dll" target="lib\netcoreapp3.1" />
3636
<file src="bin\$configuration$\netstandard2.0\Octopus.CommandLine.dll" target="lib\netstandard2.0" />
3737
</files>

source/Octopus.CommandLine.sln

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ ProjectSection(SolutionItems) = preProject
88
..\build.ps1 = ..\build.ps1
99
..\build.sh = ..\build.sh
1010
..\CONTRIBUTING.md = ..\CONTRIBUTING.md
11-
..\GitVersion.yml = ..\GitVersion.yml
1211
..\LICENSE.txt = ..\LICENSE.txt
1312
..\readme.md = ..\readme.md
13+
..\global.json = ..\global.json
14+
..\octoversion.json = ..\octoversion.json
1415
EndProjectSection
1516
EndProject
1617
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{F2E52E31-40D3-4D04-964B-10EB9432BA47}"

0 commit comments

Comments
 (0)