diff --git a/NUnitConsole.sln b/NUnitConsole.sln index 375b8a565..af5116a20 100644 --- a/NUnitConsole.sln +++ b/NUnitConsole.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29728.190 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32228.430 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{49D441DF-39FD-4F4D-AECA-86CF8EFE23AF}" ProjectSection(SolutionItems) = preProject @@ -20,6 +20,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution src\Directory.Build.props = src\Directory.Build.props GitReleaseManager.yaml = GitReleaseManager.yaml GitVersion.yml = GitVersion.yml + global.json = global.json header-check.cake = header-check.cake LICENSE.txt = LICENSE.txt NetFXTests.nunit = NetFXTests.nunit diff --git a/appveyor.yml b/appveyor.yml index 5eefdac67..193a7091a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,6 +5,19 @@ branches: except: - /^azure-/ +install: + - ps: $urlNet70RC = "https://download.visualstudio.microsoft.com/download/pr/b3b5dce4-d810-4477-a8a3-97cbb0bdf3ea/91d0dd167239cfdfb48ae18166f444d4/dotnet-sdk-7.0.100-rc.1.22431.12-win-x64.zip" + - ps: echo "Download from $urlNet70RC" + - ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetsdk" + - ps: mkdir $env:DOTNET_INSTALL_DIR -Force | Out-Null + - ps: echo "Created directory $env:DOTNET_INSTALL_DIR" + - ps: echo "Starting download" + - ps: $tempFileNet70RC = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), [System.IO.Path]::GetRandomFileName()) + - ps: (New-Object System.Net.WebClient).DownloadFile($urlNet70RC, $tempFileNet70RC) + - ps: Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::ExtractToDirectory($tempFileNet70RC, $env:DOTNET_INSTALL_DIR) + - ps: echo "Download complete" + - ps: $env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path" + build_script: - ps: .\build.ps1 --target=Appveyor --configuration=Release diff --git a/build.cake b/build.cake index 96350d17b..b934c5350 100644 --- a/build.cake +++ b/build.cake @@ -119,8 +119,13 @@ public void BuildSolution() .WithProperty("TargetFramework", "netcoreapp2.1") .WithProperty("PublishDir", BIN_DIR + "netcoreapp2.1")); + DisplayBanner("Publishing MOCK ASSEMBLY Project for NET7.0"); + MSBuild(MOCK_ASSEMBLY_PROJECT, CreateMSBuildSettings("Publish") + .WithProperty("TargetFramework", "net7.0") + .WithProperty("PublishDir", BIN_DIR + "net7.0")); + // TODO: May not be needed - foreach (var framework in new[] { "netcoreapp3.1", "net5.0" }) + foreach (var framework in new[] { "netcoreapp3.1", "net5.0", "net7.0" }) { DisplayBanner($"Publishing AGENT Project for {framework.ToUpper()}"); MSBuild(AGENT_PROJECT, CreateMSBuildSettings("Publish") diff --git a/cake/package-definitions.cake b/cake/package-definitions.cake index 93db0d309..a6d6ae7ed 100644 --- a/cake/package-definitions.cake +++ b/cake/package-definitions.cake @@ -28,6 +28,7 @@ public void InitializePackageDefinitions(ICakeContext context) NetCore31Test, Net50Test, Net60Test, + // Net70Test, NetCore21PlusNetCore31Test, NetCore21PlusNetCore31PlusNet50PlusNet60Test, Net40PlusNet60Test @@ -71,7 +72,8 @@ public void InitializePackageDefinitions(ICakeContext context) HasDirectory("tools/agents/net40").WithFiles(AGENT_FILES).AndFile("nunit.agent.addins"), HasDirectory("tools/agents/netcoreapp3.1").WithFiles(AGENT_FILES_NETCORE).AndFile("nunit.agent.addins"), HasDirectory("tools/agents/net5.0").WithFiles(AGENT_FILES_NETCORE).AndFile("nunit.agent.addins"), - HasDirectory("tools/agents/net6.0").WithFiles(AGENT_FILES_NETCORE).AndFile("nunit.agent.addins") + HasDirectory("tools/agents/net6.0").WithFiles(AGENT_FILES_NETCORE).AndFile("nunit.agent.addins"), + HasDirectory("tools/agents/net7.0").WithFiles(AGENT_FILES_NETCORE).AndFile("nunit.agent.addins") }, symbols: new PackageCheck[] { HasDirectory("tools").WithFiles(ENGINE_PDB_FILES).AndFile("nunit3-console.pdb"), @@ -79,7 +81,8 @@ public void InitializePackageDefinitions(ICakeContext context) HasDirectory("tools/agents/net40").WithFiles(AGENT_PDB_FILES), HasDirectory("tools/agents/netcoreapp3.1").WithFiles(AGENT_PDB_FILES_NETCORE), HasDirectory("tools/agents/net5.0").WithFiles(AGENT_PDB_FILES_NETCORE), - HasDirectory("tools/agents/net6.0").WithFiles(AGENT_PDB_FILES_NETCORE) + HasDirectory("tools/agents/net6.0").WithFiles(AGENT_PDB_FILES_NETCORE), + HasDirectory("tools/agents/net7.0").WithFiles(AGENT_PDB_FILES_NETCORE) }, executable: "tools/nunit3-console.exe", tests: StandardRunnerTests), @@ -110,7 +113,8 @@ public void InitializePackageDefinitions(ICakeContext context) HasDirectory("tools/agents/net40").WithFiles(AGENT_FILES).AndFile("nunit.agent.addins"), HasDirectory("tools/agents/netcoreapp3.1").WithFiles(AGENT_FILES_NETCORE).AndFile("nunit.agent.addins"), HasDirectory("tools/agents/net5.0").WithFiles(AGENT_FILES_NETCORE).AndFile("nunit.agent.addins"), - HasDirectory("tools/agents/net6.0").WithFiles(AGENT_FILES_NETCORE).AndFile("nunit.agent.addins") + HasDirectory("tools/agents/net6.0").WithFiles(AGENT_FILES_NETCORE).AndFile("nunit.agent.addins"), + HasDirectory("tools/agents/net7.0").WithFiles(AGENT_FILES_NETCORE).AndFile("nunit.agent.addins") }, executable: "tools/nunit3-console.exe", tests: StandardRunnerTests), @@ -123,6 +127,12 @@ public void InitializePackageDefinitions(ICakeContext context) checks: new PackageCheck[] { HasDirectory("NUnit.org").WithFiles("LICENSE.txt", "NOTICES.txt", "nunit.ico"), HasDirectory("NUnit.org/nunit-console").WithFiles(CONSOLE_FILES).AndFiles(ENGINE_FILES).AndFile("nunit.bundle.addins"), + HasDirectory("NUnit.org/nunit-console/agents/net20").WithFiles("nunit-agent.exe", "nunit-agent.exe.config"), + HasDirectory("NUnit.org/nunit-console/agents/net40").WithFiles("nunit-agent.exe", "nunit-agent.exe.config"), + HasDirectory("NUnit.org/nunit-console/agents/netcoreapp3.1").WithFile("nunit-agent.dll"), + HasDirectory("NUnit.org/nunit-console/agents/net5.0").WithFile("nunit-agent.dll"), + HasDirectory("NUnit.org/nunit-console/agents/net6.0").WithFile("nunit-agent.dll"), + //HasDirectory("NUnit.org/nunit-console/agents/net7.0").WithFile("nunit-agent.dll"), HasDirectory("Nunit.org/nunit-console/addins").WithFiles("nunit.core.dll", "nunit.core.interfaces.dll", "nunit.v2.driver.dll", "nunit-project-loader.dll", "vs-project-loader.dll", "nunit-v2-result-writer.dll", "teamcity-event-listener.dll") }, executable: "NUnit.org/nunit-console/nunit3-console.exe", diff --git a/cake/package-tests.cake b/cake/package-tests.cake index e28e90434..ccdb4e864 100644 --- a/cake/package-tests.cake +++ b/cake/package-tests.cake @@ -48,6 +48,12 @@ static PackageTest Net60Test = new PackageTest( "net6.0/mock-assembly.dll", MockAssemblyExpectedResult(1)); +static PackageTest Net70Test = new PackageTest( + "Net70Test", + "Run mock-assembly.dll under .NET 7.0", + "net7.0/mock-assembly.dll", + MockAssemblyExpectedResult(1)); + static PackageTest Net50Test = new PackageTest( "Net50Test", "Run mock-assembly.dll under .NET 5.0", diff --git a/cake/versioning.cake b/cake/versioning.cake index 12f0c9813..aded97410 100644 --- a/cake/versioning.cake +++ b/cake/versioning.cake @@ -77,6 +77,10 @@ public class BuildVersion string branchName = _gitVersion.BranchName; + // Treat version3 branch as an alternate "main" + if (branchName == "version3") + label = "dev"; + // We don't currently use this pattern, but check in case we do later. if (branchName.StartsWith("feature/")) branchName = branchName.Substring(8); diff --git a/choco/nunit-console-runner.nuspec b/choco/nunit-console-runner.nuspec index f8f321b5e..2739816f6 100644 --- a/choco/nunit-console-runner.nuspec +++ b/choco/nunit-console-runner.nuspec @@ -92,5 +92,15 @@ + + + + + + + + + + diff --git a/global.json b/global.json index 69d60238d..c18e8aeca 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "6.0.101", - "rollForward": "patch" + "version": "7.0.100-rc.1.22431.12", + "rollForward": "feature" } } \ No newline at end of file diff --git a/msi/nunit/engine-files.wxi b/msi/nunit/engine-files.wxi index 457244bd6..c8791fcdc 100644 --- a/msi/nunit/engine-files.wxi +++ b/msi/nunit/engine-files.wxi @@ -49,6 +49,7 @@ + @@ -174,5 +175,34 @@ Source="$(var.InstallImage)bin/net6.0/testcentric.engine.metadata.dll" /> + + + + + + + + + + + + + + + + + + diff --git a/msi/nunit/runner-directories.wxi b/msi/nunit/runner-directories.wxi index 1f4eab58e..c3483e20e 100644 --- a/msi/nunit/runner-directories.wxi +++ b/msi/nunit/runner-directories.wxi @@ -16,6 +16,7 @@ + diff --git a/nuget/runners/nunit.console-runner.nuspec b/nuget/runners/nunit.console-runner.nuspec index 032d4d088..2d58e7123 100644 --- a/nuget/runners/nunit.console-runner.nuspec +++ b/nuget/runners/nunit.console-runner.nuspec @@ -93,6 +93,19 @@ + + + + + + + + + + + + + diff --git a/src/NUnitConsole/nunit3-console/Program.cs b/src/NUnitConsole/nunit3-console/Program.cs index c9c5d6d3e..c0c8a4d10 100644 --- a/src/NUnitConsole/nunit3-console/Program.cs +++ b/src/NUnitConsole/nunit3-console/Program.cs @@ -106,8 +106,9 @@ public static int Main(string[] args) if (Options.WorkDirectory != null) engine.WorkDirectory = Options.WorkDirectory; - if (Options.InternalTraceLevel != null) - engine.InternalTraceLevel = (InternalTraceLevel)Enum.Parse(typeof(InternalTraceLevel), Options.InternalTraceLevel); + engine.InternalTraceLevel = Options.InternalTraceLevel != null + ? (InternalTraceLevel)Enum.Parse(typeof(InternalTraceLevel), Options.InternalTraceLevel) + : InternalTraceLevel.Off; try { diff --git a/src/NUnitEngine/mock-assembly/mock-assembly.csproj b/src/NUnitEngine/mock-assembly/mock-assembly.csproj index f60671084..aef70f591 100644 --- a/src/NUnitEngine/mock-assembly/mock-assembly.csproj +++ b/src/NUnitEngine/mock-assembly/mock-assembly.csproj @@ -2,7 +2,7 @@ NUnit.Tests - net35;net40;netcoreapp2.1;netcoreapp3.1;net5.0;net6.0 + net35;net40;netcoreapp2.1;netcoreapp3.1;net5.0;net6.0;net7.0 true ..\..\nunit.snk false diff --git a/src/NUnitEngine/nunit-agent/Program.cs b/src/NUnitEngine/nunit-agent/Program.cs index 4c98c0591..f66171d31 100644 --- a/src/NUnitEngine/nunit-agent/Program.cs +++ b/src/NUnitEngine/nunit-agent/Program.cs @@ -61,7 +61,6 @@ public static void Main(string[] args) } var logName = $"nunit-agent_{pid}.log"; - InternalTrace.Initialize(Path.Combine(workDirectory, logName), traceLevel); log = InternalTrace.GetLogger(typeof(NUnitTestAgent)); log.Info("Agent process {0} starting", pid); @@ -71,7 +70,13 @@ public static void Main(string[] args) LocateAgencyProcess(agencyPid); -#if NETCOREAPP3_1 +#if NET7_0 + log.Info($"Running .NET 7.0 agent under {RuntimeInformation.FrameworkDescription}"); +#elif NET6_0 + log.Info($"Running .NET 6.0 agent under {RuntimeInformation.FrameworkDescription}"); +#elif NET5_0 + log.Info($"Running .NET 5.0 agent under {RuntimeInformation.FrameworkDescription}"); +#elif NETCOREAPP3_1 log.Info($"Running .NET Core 3.1 agent under {RuntimeInformation.FrameworkDescription}"); #elif NET40 log.Info($"Running .NET 4.0 agent under {RuntimeFramework.CurrentFramework.DisplayName}"); diff --git a/src/NUnitEngine/nunit-agent/nunit-agent.csproj b/src/NUnitEngine/nunit-agent/nunit-agent.csproj index aeca8e54a..317315028 100644 --- a/src/NUnitEngine/nunit-agent/nunit-agent.csproj +++ b/src/NUnitEngine/nunit-agent/nunit-agent.csproj @@ -3,7 +3,7 @@ Exe nunit.agent - net20;net40;netcoreapp3.1;net5.0;net6.0 + net20;net40;netcoreapp3.1;net5.0;net6.0;net7.0 app.manifest ..\..\..\nunit.ico false diff --git a/src/NUnitEngine/nunit.engine.core/RuntimeFramework.cs b/src/NUnitEngine/nunit.engine.core/RuntimeFramework.cs index 33fc7116b..ce3a7f35b 100644 --- a/src/NUnitEngine/nunit.engine.core/RuntimeFramework.cs +++ b/src/NUnitEngine/nunit.engine.core/RuntimeFramework.cs @@ -201,6 +201,8 @@ private Version GetClrVersionForFramework(Version frameworkVersion) return new Version(5, 0, 1); case 6: return new Version(6, 0, 0); + case 7: + return new Version(7, 0, 0); } break; } diff --git a/src/NUnitEngine/nunit.engine/Services/AgentProcess.cs b/src/NUnitEngine/nunit.engine/Services/AgentProcess.cs index 6411d810e..b98352026 100644 --- a/src/NUnitEngine/nunit.engine/Services/AgentProcess.cs +++ b/src/NUnitEngine/nunit.engine/Services/AgentProcess.cs @@ -53,7 +53,7 @@ public AgentProcess(TestAgency agency, TestPackage package, Guid agentId) StartInfo.FileName = RuntimeFramework.MonoExePath; string monoOptions = "--runtime=v" + TargetRuntime.ClrVersion.ToString(3); monoOptions += " --debug"; - StartInfo.Arguments = string.Format("{0} \"{1}\" {2}", monoOptions, AgentExePath, AgentArgs); + StartInfo.Arguments = $"{monoOptions} \"{AgentExePath}\" {AgentArgs}"; } else if (TargetRuntime.Runtime == RuntimeType.Net) { @@ -64,7 +64,7 @@ public AgentProcess(TestAgency agency, TestPackage package, Guid agentId) else if (TargetRuntime.Runtime == RuntimeType.NetCore) { StartInfo.FileName = "dotnet"; - StartInfo.Arguments = $"{AgentExePath} {AgentArgs}"; + StartInfo.Arguments = $"\"{AgentExePath}\" {AgentArgs}"; StartInfo.LoadUserProfile = loadUserProfile; // TODO: Remove the windows limitation and the use of a hard-coded path. @@ -116,27 +116,24 @@ public static string GetTestAgentExePath(RuntimeFramework targetRuntime, bool re string runtimeDir; string agentName; - string agentExtension; int major = targetRuntime.FrameworkVersion.Major; switch (targetRuntime.Runtime) { case RuntimeType.Net: case RuntimeType.Mono: runtimeDir = major >= 4 ? "net40" : "net20"; - agentName = requires32Bit ? "nunit-agent-x86" : "nunit-agent"; - agentExtension = ".exe"; + agentName = requires32Bit ? "nunit-agent-x86.exe" : "nunit-agent.exe"; break; case RuntimeType.NetCore: - runtimeDir = major >= 6 ? "net6.0" : major == 5 ? "net5.0" : "netcoreapp3.1"; - agentName = "nunit-agent"; - agentExtension = ".dll"; + runtimeDir = major >= 7 ? "net7.0" : major == 6 ? "net6.0" : major == 5 ? "net5.0" : "netcoreapp3.1"; + agentName = "nunit-agent.dll"; break; default: log.Error($"Unknown runtime type: {targetRuntime.Runtime}"); return null; } - return Path.Combine(Path.Combine(agentsDir, runtimeDir), agentName + agentExtension); + return Path.Combine(Path.Combine(agentsDir, runtimeDir), agentName); } } }