From ccb093f268e7cd5dc37f874d19a8ea0da3e00bba Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 23 Mar 2020 15:28:06 -0700 Subject: [PATCH 1/8] Update the tools packages to roughly match VS16.5 --- tools/packages.config | 50 +++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/tools/packages.config b/tools/packages.config index 595625dcc9..734d9ec220 100644 --- a/tools/packages.config +++ b/tools/packages.config @@ -1,31 +1,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + From 2b1b9b272964b1de8513edeedb67287ef44fad92 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 24 Mar 2020 09:31:43 -0700 Subject: [PATCH 2/8] Upgrade NuGet tools to preview build --- tools/packages.config | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tools/packages.config b/tools/packages.config index 734d9ec220..fc509ac78f 100644 --- a/tools/packages.config +++ b/tools/packages.config @@ -8,20 +8,20 @@ - + - - - - - - - - - - - - + + + + + + + + + + + + From 04a71defc0ef649b66e1080dce50a3d41f697d3d Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 24 Mar 2020 09:57:09 -0700 Subject: [PATCH 3/8] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ae47c27de..c36733dc85 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 (PR: [#1746](https://github.com/OmniSharp/omnisharp-roslyn/pull/1746)) ## [1.34.14] - 2020-03-09 * Added support for `annotations` value of `Nullable` csproj property ([#1721](https://github.com/OmniSharp/omnisharp-roslyn/issues/1721), PR: [#1722](https://github.com/OmniSharp/omnisharp-roslyn/pull/1722)) From 6b53197b951d514792735703f049ee5b5d990e3a Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 24 Mar 2020 10:04:29 -0700 Subject: [PATCH 4/8] Add issue link to changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c36733dc85..2e5ebdd709 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +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 (PR: [#1746](https://github.com/OmniSharp/omnisharp-roslyn/pull/1746)) +* 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)) ## [1.34.14] - 2020-03-09 * Added support for `annotations` value of `Nullable` csproj property ([#1721](https://github.com/OmniSharp/omnisharp-roslyn/issues/1721), PR: [#1722](https://github.com/OmniSharp/omnisharp-roslyn/pull/1722)) From ffbd1553263aa5faae152856a752b361a24021e1 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 24 Mar 2020 20:55:53 -0700 Subject: [PATCH 5/8] Add ability install multiple SDKs for tests --- build.cake | 9 ++++++--- build.json | 4 +++- scripts/common.cake | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) 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..e27bc012bb 100644 --- a/build.json +++ b/build.json @@ -1,7 +1,9 @@ { "DotNetInstallScriptURL": "https://dot.net/v1", "DotNetChannel": "Current", - "DotNetVersion": "3.0.100", + "DotNetVersions": [ + "3.0.100" + ], "RequiredMonoVersion": "6.6.0", "DownloadURL": "https://roslynomnisharp.blob.core.windows.net/ext", "MonoRuntimeMacOS": "mono.macOS-6.8.0.105.zip", 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; } From 8877673b54b950263ef184ee88d514e4aefd5606 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 24 Mar 2020 21:03:35 -0700 Subject: [PATCH 6/8] Add .NET 5.0 test project --- build.json | 10 ++-- .../Net50Project/Net50Solution.sln | 48 +++++++++++++++++++ .../Net50Project/console-app/Program.cs | 12 +++++ .../console-app/console-app.csproj | 10 ++++ .../test-projects/Net50Project/global.json | 5 ++ .../Net50Project/net50-lib/Class1.cs | 8 ++++ .../Net50Project/net50-lib/net50-lib.csproj | 7 +++ .../WorkspaceInformationTests.cs | 21 ++++++++ 8 files changed, 117 insertions(+), 4 deletions(-) create mode 100644 test-assets/test-projects/Net50Project/Net50Solution.sln create mode 100644 test-assets/test-projects/Net50Project/console-app/Program.cs create mode 100644 test-assets/test-projects/Net50Project/console-app/console-app.csproj create mode 100644 test-assets/test-projects/Net50Project/global.json create mode 100644 test-assets/test-projects/Net50Project/net50-lib/Class1.cs create mode 100644 test-assets/test-projects/Net50Project/net50-lib/net50-lib.csproj diff --git a/build.json b/build.json index e27bc012bb..7301822d3e 100644 --- a/build.json +++ b/build.json @@ -1,8 +1,9 @@ { "DotNetInstallScriptURL": "https://dot.net/v1", - "DotNetChannel": "Current", + "DotNetChannel": "Preview", "DotNetVersions": [ - "3.0.100" + "3.0.100", + "5.0.100-preview.2.20169.1" ], "RequiredMonoVersion": "6.6.0", "DownloadURL": "https://roslynomnisharp.blob.core.windows.net/ext", @@ -37,7 +38,8 @@ "ProjectWithMultiTFMLib", "ExternAlias", "ProjectWithComplexAnalyzers", - "NetCore30Project" + "NetCore30Project", + "Net50Project" ], "CakeTestAssets": [ "CakeProject" @@ -48,4 +50,4 @@ "RestoreOnlyTestAssets": [ "ProjectWithMissingType" ] -} +} \ No newline at end of file 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..d01325e15b 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.Equal("netcoreapp5.0", appProject.TargetFrameworks[0].ShortName); + var libProject = workspaceInfo.Projects.Single(proj => !proj.IsExe); + Assert.Equal("net50-lib", libProject.AssemblyName); + Assert.Equal(".NETCoreApp,Version=v5.0", libProject.TargetFramework); + Assert.Equal("net50", libProject.TargetFrameworks[0].ShortName); + } + } + [Fact] public async Task TwoProjectsWithSolution() { From aa99c2daf73d9269caa65290beb790e160b9017e Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 24 Mar 2020 21:03:56 -0700 Subject: [PATCH 7/8] Bump MSBuild version --- build/Packages.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 @@ - + From 39811e1e243affc4e39ce6e07e3bc537a1909528 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 24 Mar 2020 22:10:39 -0700 Subject: [PATCH 8/8] Handle various shortnames until net5.0 TFM is final --- tests/OmniSharp.MSBuild.Tests/WorkspaceInformationTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/OmniSharp.MSBuild.Tests/WorkspaceInformationTests.cs b/tests/OmniSharp.MSBuild.Tests/WorkspaceInformationTests.cs index d01325e15b..c566d50b96 100644 --- a/tests/OmniSharp.MSBuild.Tests/WorkspaceInformationTests.cs +++ b/tests/OmniSharp.MSBuild.Tests/WorkspaceInformationTests.cs @@ -92,11 +92,11 @@ public async Task Net50Solution() var appProject = workspaceInfo.Projects.Single(proj => proj.IsExe); Assert.Equal("console-app", appProject.AssemblyName); Assert.Equal(".NETCoreApp,Version=v5.0", appProject.TargetFramework); - Assert.Equal("netcoreapp5.0", appProject.TargetFrameworks[0].ShortName); + 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.Equal("net50", libProject.TargetFrameworks[0].ShortName); + Assert.Contains(libProject.TargetFrameworks[0].ShortName, new[] { "net50", "net5.0" }); } }