diff --git a/src/extension/VisualStudioProjectLoader.cs b/src/extension/VisualStudioProjectLoader.cs index 993bc68..d13b56d 100644 --- a/src/extension/VisualStudioProjectLoader.cs +++ b/src/extension/VisualStudioProjectLoader.cs @@ -76,7 +76,7 @@ namespace NUnit.Engine.Services.ProjectLoaders public bool CanLoadFrom(string path) { - return IsProjectFile(path)|| IsSolutionFile(path); + return IsProjectFile(path) || IsSolutionFile(path); } public IProject LoadFrom(string path) @@ -97,18 +97,19 @@ namespace NUnit.Engine.Services.ProjectLoaders { var project = new VSProject(path); var doc = CreateProjectDocument(path); - - switch (Path.GetExtension(path)) + var ext = Path.GetExtension(path); + + switch (ext) { case ".csproj": + case ".fsproj": + case ".vbproj": if (!project.TryLoadLegacyProject(doc)) if (!project.TryLoadSdkProject(doc)) project.LoadNonSdkProject(doc); break; - case ".vbproj": case ".vjsproj": - case ".fsproj": if (!project.TryLoadLegacyProject(doc)) project.LoadNonSdkProject(doc); break; @@ -118,7 +119,7 @@ namespace NUnit.Engine.Services.ProjectLoaders break; default: - break; + throw new Exception($"Unsupported project type: '{ext}'"); } return project; diff --git a/src/tests/SdkProjectLoadTests.cs b/src/tests/SdkProjectLoadTests.cs index bef99e5..5b9eb83 100644 --- a/src/tests/SdkProjectLoadTests.cs +++ b/src/tests/SdkProjectLoadTests.cs @@ -78,7 +78,13 @@ namespace NUnit.Engine.Services.ProjectLoaders.Tests new ProjectData("sdk-netstandard2.0-minimal-dll.csproj") .RuntimeDirectory("netstandard2.0"), new ProjectData("sdk-netstandard2.0-minimal-exe.csproj") - .RuntimeDirectory("netstandard2.0") + .RuntimeDirectory("netstandard2.0"), + new ProjectData("sdk-net5.0-minimal-exe.fsproj") + .WithConfig("Debug", "bin/Debug/net5.0/sdk-net5.0-minimal-exe.exe") + .WithConfig("Release", "bin/Release/net5.0/sdk-net5.0-minimal-exe.exe"), + new ProjectData("sdk-net5.0-minimal-exe.vbproj") + .WithConfig("Debug", "bin/Debug/net5.0/sdk-net5.0-minimal-exe.exe") + .WithConfig("Release", "bin/Release/net5.0/sdk-net5.0-minimal-exe.exe") }; [TestCaseSource(nameof(SdkProjects))] diff --git a/src/tests/resources/sdk-net5.0-minimal-exe.fsproj b/src/tests/resources/sdk-net5.0-minimal-exe.fsproj new file mode 100644 index 0000000..4e0f678 --- /dev/null +++ b/src/tests/resources/sdk-net5.0-minimal-exe.fsproj @@ -0,0 +1,12 @@ + + + + Exe + net5.0 + + + + + + + diff --git a/src/tests/resources/sdk-net5.0-minimal-exe.vbproj b/src/tests/resources/sdk-net5.0-minimal-exe.vbproj new file mode 100644 index 0000000..9b11fb9 --- /dev/null +++ b/src/tests/resources/sdk-net5.0-minimal-exe.vbproj @@ -0,0 +1,9 @@ + + + + Exe + VBConsoleApp + net5.0 + + + diff --git a/src/tests/vs-project-loader.tests.csproj b/src/tests/vs-project-loader.tests.csproj index c90fbf7..6d953a4 100644 --- a/src/tests/vs-project-loader.tests.csproj +++ b/src/tests/vs-project-loader.tests.csproj @@ -74,4 +74,8 @@ + + + +