From b3b3bee16ab9c76757f735a8b3a6e06cfa45205d Mon Sep 17 00:00:00 2001 From: "Terje Sandstrom (AAD)" Date: Sun, 12 Feb 2023 10:43:41 +0100 Subject: [PATCH 1/2] Added net 8 --- BUILDING.md | 16 ++++++++++++++-- GitVersion.yml | 2 +- .../RuntimeFrameworks/NetCoreFrameworkLocator.cs | 2 +- .../nunit.engine.core/RuntimeFramework.cs | 2 ++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index 479c6a18d..46442cac8 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -15,9 +15,12 @@ See also [Building and testing for Linux on a Windows machine](#building-and-tes ## Prerequisites -- Visual Studio 2017 Update 5 or newer to build on Windows +- Visual Studio 2017 Update 5 or newer to build on Windows. Preferably use VS2022. - .NET 4.5+ or Mono 5.10.0+ -- .NET Core 1.1.6 or newer +- A set of runtimes, from .NET Core 2.1.30 runtime, and some more, see below. You will also need the net framework 3.5 service pack 1 installed. +- An appropriate newer dotnet SDK, e.g. .net 6. +- Chocolatey : [Install instructions here](https://docs.chocolatey.org/en-us/choco/setup) +- Wix: [Install instructions here](https://wixtoolset.org/docs/wix3/). Note that you need to install both the [3.11 toolset](https://github.com/wixtoolset/wix3/releases/tag/wix3112rtm) (Use the wix311.exe installer) and the [VS2022 Vsix extension](https://marketplace.visualstudio.com/items?itemName=WixToolset.WixToolsetVisualStudio2022Extension). ## Solution Build @@ -25,6 +28,15 @@ All projects are built together using a single Visual Studio solution NUnitConso built with Visual Studio or on the command line using Cake. The projects all place their output in a common bin directory. +The easiest way is to use the command line with just `build`. If that works, you can test it doing `build -t test` and then create a package doing `build -t package`. +On each step you may get some errors, mostly due to missing frameworks. Install whatever is required. We will work on getting a complete list up. +The generated packages can be found in the `package` subfolder. + +## Setting a new version + +Before building a new package, ensure you set the appropriate (according to [Semver](https://semver.org) ) next version number to be used for the final package. Note that you dont need to set any prerelase tags, those will be done automatically based on whatever non-main branch you are building from. +You set that version number in the 1st line of the `gitversion.yml` file. + ## Build Script We use **Cake** (http://cakebuild.net) to build NUnit for distribution. The primary script that controls diff --git a/GitVersion.yml b/GitVersion.yml index b6ecd6f59..1303ebb0c 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,4 +1,4 @@ -next-version: 3.16.2 +next-version: 3.16.3 mode: ContinuousDelivery legacy-semver-padding: 5 build-metadata-padding: 5 diff --git a/src/NUnitEngine/nunit.engine.core/Internal/RuntimeFrameworks/NetCoreFrameworkLocator.cs b/src/NUnitEngine/nunit.engine.core/Internal/RuntimeFrameworks/NetCoreFrameworkLocator.cs index 00613c54c..5d1d36827 100644 --- a/src/NUnitEngine/nunit.engine.core/Internal/RuntimeFrameworks/NetCoreFrameworkLocator.cs +++ b/src/NUnitEngine/nunit.engine.core/Internal/RuntimeFrameworks/NetCoreFrameworkLocator.cs @@ -26,7 +26,7 @@ public static IEnumerable FindDotNetCoreFrameworks() alreadyFound.Add(newVersion); // HACK: Avoid Exception for an unknown version - see issue #1223 // Requires change in RuntimeFramework.GetClrVersionForFramework() - if (newVersion.Major <= 7) + if (newVersion.Major <= 8) yield return new RuntimeFramework(RuntimeType.NetCore, newVersion); else log.Error($"Found .NET {newVersion.ToString(2)}, which is not yet supported."); diff --git a/src/NUnitEngine/nunit.engine.core/RuntimeFramework.cs b/src/NUnitEngine/nunit.engine.core/RuntimeFramework.cs index 569bf69c2..110e9d8db 100644 --- a/src/NUnitEngine/nunit.engine.core/RuntimeFramework.cs +++ b/src/NUnitEngine/nunit.engine.core/RuntimeFramework.cs @@ -204,6 +204,8 @@ private Version GetClrVersionForFramework(Version frameworkVersion) return new Version(6, 0, 0); case 7: return new Version(7, 0, 0); + case 8: + return new Version(8, 0, 0); } break; } From 0d4a2955a8a777901820427b43b7419cbcaf96d5 Mon Sep 17 00:00:00 2001 From: Terje Sandstrom Date: Mon, 20 Feb 2023 20:49:11 +0100 Subject: [PATCH 2/2] Fixed up ref comments --- .../RuntimeFrameworks/NetCoreFrameworkLocator.cs | 12 +++--------- .../nunit.engine.core/RuntimeFramework.cs | 9 ++------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/NUnitEngine/nunit.engine.core/Internal/RuntimeFrameworks/NetCoreFrameworkLocator.cs b/src/NUnitEngine/nunit.engine.core/Internal/RuntimeFrameworks/NetCoreFrameworkLocator.cs index 5d1d36827..f3852cdc5 100644 --- a/src/NUnitEngine/nunit.engine.core/Internal/RuntimeFrameworks/NetCoreFrameworkLocator.cs +++ b/src/NUnitEngine/nunit.engine.core/Internal/RuntimeFrameworks/NetCoreFrameworkLocator.cs @@ -20,16 +20,10 @@ public static IEnumerable FindDotNetCoreFrameworks() foreach (string dirName in GetRuntimeDirectories()) { - Version newVersion; - if (TryGetVersionFromString(dirName, out newVersion) && !alreadyFound.Contains(newVersion)) + if (TryGetVersionFromString(dirName, out var newVersion) && !alreadyFound.Contains(newVersion)) { alreadyFound.Add(newVersion); - // HACK: Avoid Exception for an unknown version - see issue #1223 - // Requires change in RuntimeFramework.GetClrVersionForFramework() - if (newVersion.Major <= 8) - yield return new RuntimeFramework(RuntimeType.NetCore, newVersion); - else - log.Error($"Found .NET {newVersion.ToString(2)}, which is not yet supported."); + yield return new RuntimeFramework(RuntimeType.NetCore, newVersion); } } @@ -76,7 +70,7 @@ private static IEnumerable GetRuntimeList() { process.Start(); } - catch(Exception) + catch (Exception) { // No versions are installed, just return yield break; diff --git a/src/NUnitEngine/nunit.engine.core/RuntimeFramework.cs b/src/NUnitEngine/nunit.engine.core/RuntimeFramework.cs index 110e9d8db..94beafd76 100644 --- a/src/NUnitEngine/nunit.engine.core/RuntimeFramework.cs +++ b/src/NUnitEngine/nunit.engine.core/RuntimeFramework.cs @@ -200,14 +200,9 @@ private Version GetClrVersionForFramework(Version frameworkVersion) return new Version(3, 1, 10); case 5: return new Version(5, 0, 1); - case 6: - return new Version(6, 0, 0); - case 7: - return new Version(7, 0, 0); - case 8: - return new Version(8, 0, 0); + default: + return new Version(frameworkVersion.Major, 0, 0); } - break; } throw new ArgumentException("Unknown framework version " + frameworkVersion.ToString(), "version");