diff --git a/build.json b/build.json index 606b11f567..eaf5892634 100644 --- a/build.json +++ b/build.json @@ -2,6 +2,7 @@ "DotNetInstallScriptURL": "https://dot.net/v1", "DotNetChannel": "Preview", "DotNetVersions": [ + "2.1.811", "3.1.403", "5.0.100" ], @@ -44,6 +45,7 @@ "ProjectWithDisabledAnalyzers2", "ProjectWithAnalyzers", "NetCore21Project", + "NetCore31Project", "Net50Project", "ProjectWithAnalyzersAndEditorConfig", "ProjectWithParentEditorConfig" diff --git a/test-assets/test-projects/NetCore21Project/global.json b/test-assets/test-projects/NetCore21Project/global.json new file mode 100644 index 0000000000..4b30b20fac --- /dev/null +++ b/test-assets/test-projects/NetCore21Project/global.json @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "2.1.811" + } +} diff --git a/test-assets/test-projects/NetCore31Project/NetCore31Project.csproj b/test-assets/test-projects/NetCore31Project/NetCore31Project.csproj new file mode 100644 index 0000000000..23df6047ff --- /dev/null +++ b/test-assets/test-projects/NetCore31Project/NetCore31Project.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp2.1 + + + diff --git a/test-assets/test-projects/NetCore31Project/Program.cs b/test-assets/test-projects/NetCore31Project/Program.cs new file mode 100644 index 0000000000..dbae8113d5 --- /dev/null +++ b/test-assets/test-projects/NetCore31Project/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace ProjectAndSolution +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} diff --git a/test-assets/test-projects/NetCore31Project/global.json b/test-assets/test-projects/NetCore31Project/global.json new file mode 100644 index 0000000000..2412b02fcf --- /dev/null +++ b/test-assets/test-projects/NetCore31Project/global.json @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "3.1.403" + } +} diff --git a/tests/OmniSharp.MSBuild.Tests/ProjectLoadListenerTests.cs b/tests/OmniSharp.MSBuild.Tests/ProjectLoadListenerTests.cs index 18deacf2c9..2538e6dd00 100644 --- a/tests/OmniSharp.MSBuild.Tests/ProjectLoadListenerTests.cs +++ b/tests/OmniSharp.MSBuild.Tests/ProjectLoadListenerTests.cs @@ -185,11 +185,11 @@ public async Task The_correct_project_capablities_is_emitted() using var testProject = await TestAssets.Instance.GetTestProjectAsync("NetCore21Project"); using var host = CreateMSBuildTestHost(testProject.Directory, emitter.AsExportDescriptionProvider(LoggerFactory)); Assert.Single(emitter.ReceivedMessages); - Assert.Equal("GenerateDocumentationFile CSharp Managed ReferencesFolder LanguageService RelativePathDerivedDefaultNamespace AssemblyReferences COMReferences ProjectReferences SharedProjectReferences OutputGroups AllTargetOutputGroups VisualStudioWellKnownOutputGroups SingleFileGenerators DeclaredSourceItems UserSourceItems BuildWindowsDesktopTarget CrossPlatformExecutable Pack", string.Join(" ", emitter.ReceivedMessages[0].ProjectCapabilities)); + Assert.Equal("GenerateDocumentationFile CSharp Managed ReferencesFolder LanguageService RelativePathDerivedDefaultNamespace AssemblyReferences COMReferences ProjectReferences SharedProjectReferences OutputGroups AllTargetOutputGroups VisualStudioWellKnownOutputGroups SingleFileGenerators DeclaredSourceItems UserSourceItems BuildWindowsDesktopTarget CrossPlatformExecutable FolderPublish Pack", string.Join(" ", emitter.ReceivedMessages[0].ProjectCapabilities)); } [Fact] - public async Task The_correct_sdk_version_is_emitted() + public async Task The_correct_sdk_version_is_emitted_NETCore2_1() { // Arrange var emitter = new ProjectLoadTestEventEmitter(); @@ -197,11 +197,23 @@ public async Task The_correct_sdk_version_is_emitted() using var testProject = await TestAssets.Instance.GetTestProjectAsync("NetCore21Project"); using var host = CreateMSBuildTestHost(testProject.Directory, emitter.AsExportDescriptionProvider(LoggerFactory)); Assert.Single(emitter.ReceivedMessages); + Assert.Equal(GetHashedFileExtension("2.1.811"), emitter.ReceivedMessages[0].SdkVersion); + } + + [Fact] + public async Task The_correct_sdk_version_is_emitted_NETCore3_1() + { + // Arrange + var emitter = new ProjectLoadTestEventEmitter(); + + using var testProject = await TestAssets.Instance.GetTestProjectAsync("NetCore31Project"); + using var host = CreateMSBuildTestHost(testProject.Directory, emitter.AsExportDescriptionProvider(LoggerFactory)); + Assert.Single(emitter.ReceivedMessages); Assert.Equal(GetHashedFileExtension("3.1.403"), emitter.ReceivedMessages[0].SdkVersion); } [Fact] - public async Task The_correct_sdk_version_is_emitted_2() + public async Task The_correct_sdk_version_is_emitted_NET5() { // Arrange var emitter = new ProjectLoadTestEventEmitter();