diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a1dafff78..413b480ee7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All changes to the project will be documented in this file. ## [1.34.15] - not yet released * Support for .NET Core 3.1 in csx files (PR: [#1731](https://github.com/OmniSharp/omnisharp-roslyn/pull/1731)) +* Update the minimal MSBuild to better support .NET 5 Previews ([omnisharp-vscode#3653](https://github.com/OmniSharp/omnisharp-vscode/issues/3653), PR: [#1746](https://github.com/OmniSharp/omnisharp-roslyn/pull/1746)) * Updated to Roslyn [3.6.0-3.20170.19] (PR: [#1745](https://github.com/OmniSharp/omnisharp-roslyn/pull/1745)) ## [1.34.14] - 2020-03-09 diff --git a/build.cake b/build.cake index 2e3dd057e3..db260ab62b 100644 --- a/build.cake +++ b/build.cake @@ -114,9 +114,12 @@ Task("InstallDotNetCoreSdk") { if (!useGlobalDotNetSdk) { - InstallDotNetSdk(env, buildPlan, - version: buildPlan.DotNetVersion, - installFolder: env.Folders.DotNetSdk); + foreach (var dotnetVersion in buildPlan.DotNetVersions) + { + InstallDotNetSdk(env, buildPlan, + version: dotnetVersion, + installFolder: env.Folders.DotNetSdk); + } // Add non-legacy .NET SDK to PATH var oldPath = Environment.GetEnvironmentVariable("PATH"); diff --git a/build.json b/build.json index 11090f0a04..7301822d3e 100644 --- a/build.json +++ b/build.json @@ -1,7 +1,10 @@ { "DotNetInstallScriptURL": "https://dot.net/v1", - "DotNetChannel": "Current", - "DotNetVersion": "3.0.100", + "DotNetChannel": "Preview", + "DotNetVersions": [ + "3.0.100", + "5.0.100-preview.2.20169.1" + ], "RequiredMonoVersion": "6.6.0", "DownloadURL": "https://roslynomnisharp.blob.core.windows.net/ext", "MonoRuntimeMacOS": "mono.macOS-6.8.0.105.zip", @@ -35,7 +38,8 @@ "ProjectWithMultiTFMLib", "ExternAlias", "ProjectWithComplexAnalyzers", - "NetCore30Project" + "NetCore30Project", + "Net50Project" ], "CakeTestAssets": [ "CakeProject" @@ -46,4 +50,4 @@ "RestoreOnlyTestAssets": [ "ProjectWithMissingType" ] -} +} \ No newline at end of file diff --git a/build/Packages.props b/build/Packages.props index d276f6da23..ee3281046b 100644 --- a/build/Packages.props +++ b/build/Packages.props @@ -3,7 +3,7 @@ xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - 16.4.0 + 16.5.0 5.2.0 3.6.0-2.20167.2 2.4.0 @@ -82,7 +82,7 @@ - + diff --git a/scripts/common.cake b/scripts/common.cake index dec348f57b..e5e2cb8690 100644 --- a/scripts/common.cake +++ b/scripts/common.cake @@ -343,7 +343,7 @@ public class BuildPlan { public string DotNetInstallScriptURL { get; set; } public string DotNetChannel { get; set; } - public string DotNetVersion { get; set; } + public string[] DotNetVersions { get; set; } public string RequiredMonoVersion { get; set; } public string DownloadURL { get; set; } public string MonoRuntimeMacOS { get; set; } diff --git a/test-assets/test-projects/Net50Project/Net50Solution.sln b/test-assets/test-projects/Net50Project/Net50Solution.sln new file mode 100644 index 0000000000..a20aeb26f4 --- /dev/null +++ b/test-assets/test-projects/Net50Project/Net50Solution.sln @@ -0,0 +1,48 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26124.0 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "console-app", "console-app\console-app.csproj", "{ADE4E8E3-05F1-429F-966F-151F8E889485}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "net50-lib", "net50-lib\net50-lib.csproj", "{DD826619-8811-4F84-8697-4B6C6D535B1C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {ADE4E8E3-05F1-429F-966F-151F8E889485}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ADE4E8E3-05F1-429F-966F-151F8E889485}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ADE4E8E3-05F1-429F-966F-151F8E889485}.Debug|x64.ActiveCfg = Debug|Any CPU + {ADE4E8E3-05F1-429F-966F-151F8E889485}.Debug|x64.Build.0 = Debug|Any CPU + {ADE4E8E3-05F1-429F-966F-151F8E889485}.Debug|x86.ActiveCfg = Debug|Any CPU + {ADE4E8E3-05F1-429F-966F-151F8E889485}.Debug|x86.Build.0 = Debug|Any CPU + {ADE4E8E3-05F1-429F-966F-151F8E889485}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ADE4E8E3-05F1-429F-966F-151F8E889485}.Release|Any CPU.Build.0 = Release|Any CPU + {ADE4E8E3-05F1-429F-966F-151F8E889485}.Release|x64.ActiveCfg = Release|Any CPU + {ADE4E8E3-05F1-429F-966F-151F8E889485}.Release|x64.Build.0 = Release|Any CPU + {ADE4E8E3-05F1-429F-966F-151F8E889485}.Release|x86.ActiveCfg = Release|Any CPU + {ADE4E8E3-05F1-429F-966F-151F8E889485}.Release|x86.Build.0 = Release|Any CPU + {DD826619-8811-4F84-8697-4B6C6D535B1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DD826619-8811-4F84-8697-4B6C6D535B1C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DD826619-8811-4F84-8697-4B6C6D535B1C}.Debug|x64.ActiveCfg = Debug|Any CPU + {DD826619-8811-4F84-8697-4B6C6D535B1C}.Debug|x64.Build.0 = Debug|Any CPU + {DD826619-8811-4F84-8697-4B6C6D535B1C}.Debug|x86.ActiveCfg = Debug|Any CPU + {DD826619-8811-4F84-8697-4B6C6D535B1C}.Debug|x86.Build.0 = Debug|Any CPU + {DD826619-8811-4F84-8697-4B6C6D535B1C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DD826619-8811-4F84-8697-4B6C6D535B1C}.Release|Any CPU.Build.0 = Release|Any CPU + {DD826619-8811-4F84-8697-4B6C6D535B1C}.Release|x64.ActiveCfg = Release|Any CPU + {DD826619-8811-4F84-8697-4B6C6D535B1C}.Release|x64.Build.0 = Release|Any CPU + {DD826619-8811-4F84-8697-4B6C6D535B1C}.Release|x86.ActiveCfg = Release|Any CPU + {DD826619-8811-4F84-8697-4B6C6D535B1C}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/test-assets/test-projects/Net50Project/console-app/Program.cs b/test-assets/test-projects/Net50Project/console-app/Program.cs new file mode 100644 index 0000000000..23b8e7901e --- /dev/null +++ b/test-assets/test-projects/Net50Project/console-app/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace ConsoleApp +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} diff --git a/test-assets/test-projects/Net50Project/console-app/console-app.csproj b/test-assets/test-projects/Net50Project/console-app/console-app.csproj new file mode 100644 index 0000000000..276b6d4248 --- /dev/null +++ b/test-assets/test-projects/Net50Project/console-app/console-app.csproj @@ -0,0 +1,10 @@ + + + + Exe + netcoreapp5.0 + + + + + diff --git a/test-assets/test-projects/Net50Project/global.json b/test-assets/test-projects/Net50Project/global.json new file mode 100644 index 0000000000..5b9dcbe667 --- /dev/null +++ b/test-assets/test-projects/Net50Project/global.json @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "5.0.100-preview.2.20169.1" + } +} diff --git a/test-assets/test-projects/Net50Project/net50-lib/Class1.cs b/test-assets/test-projects/Net50Project/net50-lib/Class1.cs new file mode 100644 index 0000000000..4deec9bdc9 --- /dev/null +++ b/test-assets/test-projects/Net50Project/net50-lib/Class1.cs @@ -0,0 +1,8 @@ +using System; + +namespace Net50Lib +{ + public class Class1 + { + } +} diff --git a/test-assets/test-projects/Net50Project/net50-lib/net50-lib.csproj b/test-assets/test-projects/Net50Project/net50-lib/net50-lib.csproj new file mode 100644 index 0000000000..f208d303c9 --- /dev/null +++ b/test-assets/test-projects/Net50Project/net50-lib/net50-lib.csproj @@ -0,0 +1,7 @@ + + + + net5.0 + + + diff --git a/tests/OmniSharp.MSBuild.Tests/WorkspaceInformationTests.cs b/tests/OmniSharp.MSBuild.Tests/WorkspaceInformationTests.cs index 5cbb1af416..c566d50b96 100644 --- a/tests/OmniSharp.MSBuild.Tests/WorkspaceInformationTests.cs +++ b/tests/OmniSharp.MSBuild.Tests/WorkspaceInformationTests.cs @@ -79,6 +79,27 @@ public async Task NetCore30Project() } } + [Fact] + public async Task Net50Solution() + { + using (var testProject = await TestAssets.Instance.GetTestProjectAsync("Net50Project")) + using (var host = CreateMSBuildTestHost(testProject.Directory)) + { + var workspaceInfo = await host.RequestMSBuildWorkspaceInfoAsync(); + + Assert.NotNull(workspaceInfo.Projects); + Assert.Equal(2, workspaceInfo.Projects.Count); + var appProject = workspaceInfo.Projects.Single(proj => proj.IsExe); + Assert.Equal("console-app", appProject.AssemblyName); + Assert.Equal(".NETCoreApp,Version=v5.0", appProject.TargetFramework); + Assert.Contains(appProject.TargetFrameworks[0].ShortName, new[] { "net5.0", "netcoreapp5.0" }); + var libProject = workspaceInfo.Projects.Single(proj => !proj.IsExe); + Assert.Equal("net50-lib", libProject.AssemblyName); + Assert.Equal(".NETCoreApp,Version=v5.0", libProject.TargetFramework); + Assert.Contains(libProject.TargetFrameworks[0].ShortName, new[] { "net50", "net5.0" }); + } + } + [Fact] public async Task TwoProjectsWithSolution() { diff --git a/tools/packages.config b/tools/packages.config index 595625dcc9..fc509ac78f 100644 --- a/tools/packages.config +++ b/tools/packages.config @@ -1,31 +1,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + +