From 2c7d23afe91a5aecb2a6ef55eb91a55237362969 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Fri, 23 Oct 2020 13:19:43 -0700 Subject: [PATCH 1/4] Add KnownFrameworkReference items for .NET 6 Fixes https://github.com/dotnet/sdk/issues/13950 --- .../targets/GenerateBundledVersions.targets | 172 +++++++++++++++--- test/EndToEnd/ProjectBuildTests.cs | 18 ++ 2 files changed, 165 insertions(+), 25 deletions(-) diff --git a/src/redist/targets/GenerateBundledVersions.targets b/src/redist/targets/GenerateBundledVersions.targets index 7cca46584..a0e89d739 100644 --- a/src/redist/targets/GenerateBundledVersions.targets +++ b/src/redist/targets/GenerateBundledVersions.targets @@ -28,24 +28,28 @@ <_NETStandardLibraryPackageVersion>$(NETStandardLibraryRefPackageVersion) <_NETCorePlatformsPackageVersion>$(MicrosoftNETCorePlatformsPackageVersion) - <_NETCoreApp30RuntimePackVersion>3.0.3 - <_NETCoreApp30TargetingPackVersion>3.0.0 - + + <_NET50RuntimePackVersion>5.0.0-rc.2.20475.5 + <_NET50TargetingPackVersion>5.0.0-rc.2.20475.5 + <_WindowsDesktop50RuntimePackVersion>5.0.0-rc.2.20475.6 + <_WindowsDesktop50TargetingPackVersion>5.0.0-rc.2.20475.6 + <_AspNet50RuntimePackVersion>5.0.0-rc.2.20475.17 + <_AspNet50TargetingPackVersion>5.0.0-rc.2.20475.17 + <_NETCoreApp31RuntimePackVersion>3.1.7 <_NETCoreApp31TargetingPackVersion>3.1.0 - - <_WindowsDesktop30RuntimePackVersion>3.0.3 - <_WindowsDesktop30TargetingPackVersion>3.0.0 - <_WindowsDesktop31RuntimePackVersion>3.1.2 <_WindowsDesktop31TargetingPackVersion>3.1.0 - - <_AspNet30RuntimePackVersion>3.0.3 - <_AspNet30TargetingPackVersion>3.0.1 - <_AspNet31RuntimePackVersion>3.1.9 <_AspNet31TargetingPackVersion>3.1.8 + <_NETCoreApp30RuntimePackVersion>3.0.3 + <_NETCoreApp30TargetingPackVersion>3.0.0 + <_WindowsDesktop30RuntimePackVersion>3.0.3 + <_WindowsDesktop30TargetingPackVersion>3.0.0 + <_AspNet30RuntimePackVersion>3.0.3 + <_AspNet30TargetingPackVersion>3.0.1 + <_NETCoreAppTargetFrameworkVersion>$(_NETCoreAppPackageVersion.Split('.')[0]).$(_NETCoreAppPackageVersion.Split('.')[1]) <_NETStandardTargetFrameworkVersion>$(_NETStandardLibraryPackageVersion.Split('.')[0]).$(_NETStandardLibraryPackageVersion.Split('.')[1]) @@ -73,10 +77,10 @@ - + - - - + + - + + @@ -113,7 +118,8 @@ - + + @@ -206,8 +212,9 @@ Copyright (c) .NET Foundation. All rights reserved. @(ImplicitPackageVariable->'', ' ') + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/EndToEnd/ProjectBuildTests.cs b/test/EndToEnd/ProjectBuildTests.cs index 97293638a..852b933b5 100644 --- a/test/EndToEnd/ProjectBuildTests.cs +++ b/test/EndToEnd/ProjectBuildTests.cs @@ -13,6 +13,20 @@ namespace EndToEnd.Tests { public class ProjectBuildTests : TestBase { + // TODO: Once console template is updated to target net6.0, remove this logic + void RetargetProject(string projectDirectory) + { + var projectFile = Directory.GetFiles(projectDirectory, "*.csproj").Single(); + + var projectXml = XDocument.Load(projectFile); + var ns = projectXml.Root.Name.Namespace; + + projectXml.Root.Element(ns + "PropertyGroup") + .Element(ns + "TargetFramework").Value = "net6.0"; + + projectXml.Save(projectFile); + } + [Fact] public void ItCanNewRestoreBuildRunCleanMSBuildProject() { @@ -25,6 +39,8 @@ namespace EndToEnd.Tests .Execute(newArgs) .Should().Pass(); + RetargetProject(projectDirectory); + new RestoreCommand() .WithWorkingDirectory(projectDirectory) .Execute() @@ -63,6 +79,8 @@ namespace EndToEnd.Tests .Execute(newArgs) .Should().Pass(); + RetargetProject(projectDirectory); + string projectPath = Path.Combine(projectDirectory, directory.Name + ".csproj"); var project = XDocument.Load(projectPath); From 66318e6fc486e4df2781f5cfc134806f119c4259 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Sun, 25 Oct 2020 17:46:32 -0700 Subject: [PATCH 2/4] Switch to net5.0 and net6.0 spellings in BundledVersions --- .../targets/GenerateBundledVersions.targets | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/redist/targets/GenerateBundledVersions.targets b/src/redist/targets/GenerateBundledVersions.targets index a0e89d739..2070043a1 100644 --- a/src/redist/targets/GenerateBundledVersions.targets +++ b/src/redist/targets/GenerateBundledVersions.targets @@ -214,7 +214,7 @@ Copyright (c) .NET Foundation. All rights reserved. Date: Sun, 25 Oct 2020 19:19:57 -0700 Subject: [PATCH 3/4] Update tests for .NET 6 --- .../TestProjects/UseCswinrt/consolecswinrt.csproj | 2 +- src/redist/targets/GenerateBundledVersions.targets | 13 ++++++++----- .../GivenWeWantToRequireWindowsForDesktopApps.cs | 2 +- .../{GivenWindows50App.cs => GivenWindowsApp.cs} | 2 +- .../Assertions/FileInfoAssertions.cs | 11 ----------- 5 files changed, 11 insertions(+), 19 deletions(-) rename test/EndToEnd/{GivenWindows50App.cs => GivenWindowsApp.cs} (97%) diff --git a/TestAssets/TestProjects/UseCswinrt/consolecswinrt.csproj b/TestAssets/TestProjects/UseCswinrt/consolecswinrt.csproj index 9fcbef4ce..85367b5e2 100644 --- a/TestAssets/TestProjects/UseCswinrt/consolecswinrt.csproj +++ b/TestAssets/TestProjects/UseCswinrt/consolecswinrt.csproj @@ -1,7 +1,7 @@ Exe - net5.0 + net6.0 Windows diff --git a/src/redist/targets/GenerateBundledVersions.targets b/src/redist/targets/GenerateBundledVersions.targets index 2070043a1..01b904e85 100644 --- a/src/redist/targets/GenerateBundledVersions.targets +++ b/src/redist/targets/GenerateBundledVersions.targets @@ -29,10 +29,13 @@ <_NETCorePlatformsPackageVersion>$(MicrosoftNETCorePlatformsPackageVersion) + <_NET50DefaultRuntimeFrameworkVersion>5.0.0-rc.2.20475.5 <_NET50RuntimePackVersion>5.0.0-rc.2.20475.5 <_NET50TargetingPackVersion>5.0.0-rc.2.20475.5 + <_WindowsDesktop50DefaultRuntimeFrameworkVersion>5.0.0-rc.2.20475.6 <_WindowsDesktop50RuntimePackVersion>5.0.0-rc.2.20475.6 <_WindowsDesktop50TargetingPackVersion>5.0.0-rc.2.20475.6 + <_AspNet50DefaultRuntimeFrameworkVersion>5.0.0-rc.2.20475.17 <_AspNet50RuntimePackVersion>5.0.0-rc.2.20475.17 <_AspNet50TargetingPackVersion>5.0.0-rc.2.20475.17 @@ -331,7 +334,7 @@ Copyright (c) .NET Foundation. All rights reserved. (this); } - - public AndWhichConstraint HaveLastWriteTimeUtc(string because = "", params object[] reasonArgs) - { - var lastWriteTimeUtc = _fileInfo.LastWriteTimeUtc; - - Execute.Assertion - .ForCondition(lastWriteTimeUtc != null) - .BecauseOf(because, reasonArgs) - .FailWith($"Expected File {_fileInfo.FullName} to have a LastWriteTimeUTC, but it is null."); - return new AndWhichConstraint(this, lastWriteTimeUtc); - } } } From c5bc07d915fdd1c45624c7b56540eb4413d46c85 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Mon, 26 Oct 2020 20:18:09 -0700 Subject: [PATCH 4/4] Apply code review feedback --- src/redist/targets/GenerateBundledVersions.targets | 5 +++-- test/EndToEnd/ProjectBuildTests.cs | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/redist/targets/GenerateBundledVersions.targets b/src/redist/targets/GenerateBundledVersions.targets index 01b904e85..52b8a8411 100644 --- a/src/redist/targets/GenerateBundledVersions.targets +++ b/src/redist/targets/GenerateBundledVersions.targets @@ -28,7 +28,8 @@ <_NETStandardLibraryPackageVersion>$(NETStandardLibraryRefPackageVersion) <_NETCorePlatformsPackageVersion>$(MicrosoftNETCorePlatformsPackageVersion) - + <_NET50DefaultRuntimeFrameworkVersion>5.0.0-rc.2.20475.5 <_NET50RuntimePackVersion>5.0.0-rc.2.20475.5 <_NET50TargetingPackVersion>5.0.0-rc.2.20475.5 @@ -113,7 +114,7 @@ " /> - + diff --git a/test/EndToEnd/ProjectBuildTests.cs b/test/EndToEnd/ProjectBuildTests.cs index 852b933b5..190894fbb 100644 --- a/test/EndToEnd/ProjectBuildTests.cs +++ b/test/EndToEnd/ProjectBuildTests.cs @@ -14,6 +14,7 @@ namespace EndToEnd.Tests public class ProjectBuildTests : TestBase { // TODO: Once console template is updated to target net6.0, remove this logic + // https://github.com/dotnet/installer/issues/8974 void RetargetProject(string projectDirectory) { var projectFile = Directory.GetFiles(projectDirectory, "*.csproj").Single();