diff --git a/.github/workflows/integration-test.yaml b/.github/workflows/integration-test.yaml
index 7bdd3cf2c1..af2225a761 100644
--- a/.github/workflows/integration-test.yaml
+++ b/.github/workflows/integration-test.yaml
@@ -17,9 +17,6 @@ jobs:
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- - name: Restore vstest
- run: dotnet restore --packages .vstest
- working-directory: ${{ github.workspace }}/src/Stryker.Core/Stryker.Core/ToolHelpers/
- name: Pack integration test package
run: dotnet pack ${{ github.workspace }}/src/Stryker.CLI/Stryker.CLI/Stryker.CLI.csproj -p:PackageVersion=$VERSION --output ${{ github.workspace }}/publish
- name: Publish integration test package
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index d76c6cff7a..4b1d2a768b 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -133,13 +133,6 @@ stages:
displayName: 'Use dotnet'
inputs:
version: 8.x
- - task: DotNetCoreCLI@2
- displayName: 'Restore vstest binaries'
- inputs:
- command: 'custom'
- custom: 'restore'
- arguments: '--packages ./.vstest/'
- workingDirectory: 'src/Stryker.Core/Stryker.Core/ToolHelpers/'
- task: DotNetCoreCLI@2
displayName: 'Pack integrationtest packages'
inputs:
@@ -287,13 +280,6 @@ stages:
displayName: 'Use dotnet'
inputs:
version: 8.x
- - task: DotNetCoreCLI@2
- displayName: 'Restore vstest binaries'
- inputs:
- command: 'custom'
- custom: 'restore'
- arguments: '--packages ./.vstest/'
- workingDirectory: 'src/Stryker.Core/Stryker.Core/ToolHelpers/'
- task: DotNetCoreCLI@2
displayName: 'Pack Stryker.CLI'
inputs:
diff --git a/src/Stryker.Core/Stryker.Core.UnitTest/Helpers/VsTestHelperTests.cs b/src/Stryker.Core/Stryker.Core.UnitTest/Helpers/VsTestHelperTests.cs
new file mode 100644
index 0000000000..567806bdb1
--- /dev/null
+++ b/src/Stryker.Core/Stryker.Core.UnitTest/Helpers/VsTestHelperTests.cs
@@ -0,0 +1,30 @@
+using System;
+using System.IO;
+using System.Linq;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Shouldly;
+using Stryker.Core.Helpers;
+
+namespace Stryker.Core.UnitTest.Helpers;
+
+[TestClass]
+public class VsTestHelperTests : TestBase
+{
+ [TestMethod]
+ public void DeployEmbeddedVsTestBinaries()
+ {
+ var deployPath = new VsTestHelper().DeployEmbeddedVsTestBinaries();
+
+ var vsTestFiles = Directory.EnumerateFiles(deployPath, "*", SearchOption.AllDirectories).Select(Path.GetFileName).ToList();
+
+ try
+ {
+ vsTestFiles.ShouldContain("vstest.console.dll");
+ vsTestFiles.ShouldContain("vstest.console.exe");
+ }
+ finally
+ {
+ Directory.Delete(deployPath, recursive: true);
+ }
+ }
+}
diff --git a/src/Stryker.Core/Stryker.Core/Helpers/VsTestHelper.cs b/src/Stryker.Core/Stryker.Core/Helpers/VsTestHelper.cs
index f6fd6f5d4e..11093cb346 100644
--- a/src/Stryker.Core/Stryker.Core/Helpers/VsTestHelper.cs
+++ b/src/Stryker.Core/Stryker.Core/Helpers/VsTestHelper.cs
@@ -184,19 +184,27 @@ static bool TryGetNonEmptyEnvironmentVariable(string variable, out string value)
}
}
- private string DeployEmbeddedVsTestBinaries()
+ internal string DeployEmbeddedVsTestBinaries()
{
- var vsTestZip = typeof(VsTestHelper).Assembly
- .GetManifestResourceNames()
- .Single(r =>
- r.Contains("Microsoft.TestPlatform.Portable", StringComparison.InvariantCultureIgnoreCase));
+ var assembly = typeof(VsTestHelper).Assembly;
+ var vsTestZips = assembly.GetManifestResourceNames().Where(r => r == "Microsoft.TestPlatform.Portable.nupkg").ToList();
- var tempDir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName(), ".vstest");
+ var vsTestZip = vsTestZips.Count switch
+ {
+ 0 => throw new InvalidOperationException($"The Microsoft.TestPlatform.Portable.nupkg embedded resource was not found in {assembly.GetName().Name}. " +
+ "Please report this issue at https://github.com/stryker-mutator/stryker-net/issues"),
+ 1 => vsTestZips[0],
+ _ => throw new InvalidOperationException($"Multiple Microsoft.TestPlatform.Portable.nupkg embedded resources were found in {assembly.GetName().Name}. " +
+ "Please report this issue at https://github.com/stryker-mutator/stryker-net/issues"),
+ };
- using var stream = typeof(VsTestHelper).Assembly
- .GetManifestResourceStream(vsTestZip);
+ using var stream = assembly.GetManifestResourceStream(vsTestZip)
+ ?? throw new InvalidOperationException($"Failed to get the resource stream of {vsTestZip} in {assembly.GetName().Name}. " +
+ "Please report this issue at https://github.com/stryker-mutator/stryker-net/issues");
+
+ var tempDir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName(), ".vstest");
var zipPath = Path.Combine(tempDir, "vstest.zip");
- _fileSystem.Directory.CreateDirectory(Path.GetDirectoryName(zipPath));
+ _fileSystem.Directory.CreateDirectory(tempDir);
using (var file = _fileSystem.FileStream.New(zipPath, FileMode.Create))
{
diff --git a/src/Stryker.Core/Stryker.Core/Stryker.Core.csproj b/src/Stryker.Core/Stryker.Core/Stryker.Core.csproj
index ca1492e878..c5d793a7d6 100644
--- a/src/Stryker.Core/Stryker.Core/Stryker.Core.csproj
+++ b/src/Stryker.Core/Stryker.Core/Stryker.Core.csproj
@@ -32,6 +32,7 @@
+
@@ -46,7 +47,7 @@
-
+
diff --git a/src/Stryker.Core/Stryker.Core/ToolHelpers/packages.lock.json b/src/Stryker.Core/Stryker.Core/ToolHelpers/packages.lock.json
deleted file mode 100644
index 3637f108fa..0000000000
--- a/src/Stryker.Core/Stryker.Core/ToolHelpers/packages.lock.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "version": 2,
- "dependencies": {
- "net8.0": {
- "DotNet.ReproducibleBuilds": {
- "type": "Direct",
- "requested": "[1.2.25, )",
- "resolved": "1.2.25",
- "contentHash": "xCXiw7BCxHJ8pF6wPepRUddlh2dlQlbr81gXA72hdk4FLHkKXas7EH/n+fk5UCA/YfMqG1Z6XaPiUjDbUNBUzg=="
- },
- "Microsoft.TestPlatform.Portable": {
- "type": "Direct",
- "requested": "[17.11.1, )",
- "resolved": "17.11.1",
- "contentHash": "oUfqSuMe/NnDJj20+pcg3JdygS/kPOZmtLh8FKzqVvnrTeIKrYrn5PxcOn3HxBs0RgptnBqHCLIbz2RQky6T+A=="
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/Stryker.Core/Stryker.Core/ToolHelpers/vstest.fakeproject.csproj b/src/Stryker.Core/Stryker.Core/ToolHelpers/vstest.fakeproject.csproj
deleted file mode 100644
index fc1b62bd52..0000000000
--- a/src/Stryker.Core/Stryker.Core/ToolHelpers/vstest.fakeproject.csproj
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
- false
- false
-
-
-
-
-
-