Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for .Net 8.0 #1320

Merged
merged 3 commits into from
Feb 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,28 @@ 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

All projects are built together using a single Visual Studio solution NUnitConsole.sln, which may be
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
Expand Down
2 changes: 1 addition & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
next-version: 3.16.2
next-version: 3.16.3
mode: ContinuousDelivery
legacy-semver-padding: 5
build-metadata-padding: 5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,10 @@ public static IEnumerable<RuntimeFramework> 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 <= 7)
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);
}
}

Expand Down Expand Up @@ -76,7 +70,7 @@ private static IEnumerable<string> GetRuntimeList()
{
process.Start();
}
catch(Exception)
catch (Exception)
{
// No versions are installed, just return
yield break;
Expand Down
7 changes: 2 additions & 5 deletions src/NUnitEngine/nunit.engine.core/RuntimeFramework.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +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);
default:
return new Version(frameworkVersion.Major, 0, 0);
}
break;
}

throw new ArgumentException("Unknown framework version " + frameworkVersion.ToString(), "version");
Expand Down