From 06dc85904aa262059057a862687915a93c5ef86d Mon Sep 17 00:00:00 2001 From: Chris Rummel Date: Mon, 24 May 2021 14:56:19 -0500 Subject: [PATCH] Build a net46 version of MS.NET.SDK.Razor to support Omnisharp in VSCode. This also requires building some runtime and MSBuild packages as net46. Unfortunately we can't rely on the targeting packs for these because source-build does produce the packages but without the net46 runtime currently. --- .../0010-Don-t-build-for-full-fx.patch | 39 -------- ...nable-full-fx-builds-in-source-build.patch | 78 +++++++++++++++ .../0033-Build-net4-in-source-build.patch | 96 ------------------- repos/runtime.common.props | 3 + 4 files changed, 81 insertions(+), 135 deletions(-) delete mode 100644 patches/aspnetcore/0010-Don-t-build-for-full-fx.patch create mode 100644 patches/msbuild/0005-Re-enable-full-fx-builds-in-source-build.patch delete mode 100644 patches/runtime/0033-Build-net4-in-source-build.patch diff --git a/patches/aspnetcore/0010-Don-t-build-for-full-fx.patch b/patches/aspnetcore/0010-Don-t-build-for-full-fx.patch deleted file mode 100644 index ffc642d1a2..0000000000 --- a/patches/aspnetcore/0010-Don-t-build-for-full-fx.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 38298d2c21b9d955d93885fd67d45c2443c3a423 Mon Sep 17 00:00:00 2001 -From: Chris Rummel -Date: Thu, 3 Sep 2020 04:56:36 -0500 -Subject: [PATCH 10/14] Don't build for full fx - ---- - .../Sdk/src/Microsoft.NET.Sdk.BlazorWebAssembly.csproj | 2 +- - .../Microsoft.NET.Sdk.Razor/src/Microsoft.NET.Sdk.Razor.csproj | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/Components/WebAssembly/Sdk/src/Microsoft.NET.Sdk.BlazorWebAssembly.csproj b/src/Components/WebAssembly/Sdk/src/Microsoft.NET.Sdk.BlazorWebAssembly.csproj -index 42eb1d7a2d..ecdd44dc7f 100644 ---- a/src/Components/WebAssembly/Sdk/src/Microsoft.NET.Sdk.BlazorWebAssembly.csproj -+++ b/src/Components/WebAssembly/Sdk/src/Microsoft.NET.Sdk.BlazorWebAssembly.csproj -@@ -1,7 +1,7 @@ - - - MSBuild support for building Blazor WebAssembly apps. -- $(DefaultNetCoreTargetFramework);net46 -+ $(DefaultNetCoreTargetFramework) - - Microsoft.NET.Sdk.BlazorWebAssembly.Tasks - $(MSBuildProjectName).nuspec -diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/src/Microsoft.NET.Sdk.Razor.csproj b/src/Razor/Microsoft.NET.Sdk.Razor/src/Microsoft.NET.Sdk.Razor.csproj -index 27a4be1e8c..17660fab77 100644 ---- a/src/Razor/Microsoft.NET.Sdk.Razor/src/Microsoft.NET.Sdk.Razor.csproj -+++ b/src/Razor/Microsoft.NET.Sdk.Razor/src/Microsoft.NET.Sdk.Razor.csproj -@@ -1,7 +1,7 @@ -  - - Razor is a markup syntax for adding server-side logic to web pages. This package contains MSBuild support for Razor. -- $(DefaultNetCoreTargetFramework);net46 -+ $(DefaultNetCoreTargetFramework) - - Microsoft.NET.Sdk.Razor.Tasks - $(MSBuildProjectName).nuspec --- -2.18.0 - diff --git a/patches/msbuild/0005-Re-enable-full-fx-builds-in-source-build.patch b/patches/msbuild/0005-Re-enable-full-fx-builds-in-source-build.patch new file mode 100644 index 0000000000..0e00daff63 --- /dev/null +++ b/patches/msbuild/0005-Re-enable-full-fx-builds-in-source-build.patch @@ -0,0 +1,78 @@ +From 9b33580763b2891002fcd1e53ec3101b3f381fca Mon Sep 17 00:00:00 2001 +From: Chris Rummel +Date: Fri, 21 May 2021 02:36:31 -0500 +Subject: [PATCH 5/5] Re-enable full fx builds in source-build. + +This also adds the net46 framework to support AspNetCore building a +net46 version of Microsoft.NET.Sdk.Razor.dll, which is required to +support Omnisharp in VSCode. + +--- + Directory.Build.props | 2 +- + eng/Packages.props | 1 + + src/Directory.Build.props | 3 +-- + src/Utilities/Microsoft.Build.Utilities.csproj | 4 ++++ + 4 files changed, 7 insertions(+), 3 deletions(-) + +diff --git a/Directory.Build.props b/Directory.Build.props +index 1683a4c9..4e62284c 100644 +--- a/Directory.Build.props ++++ b/Directory.Build.props +@@ -13,7 +13,7 @@ + + + +- net472 ++ net472;net46 + + + +diff --git a/eng/Packages.props b/eng/Packages.props +index 6b716285..c38ee030 100644 +--- a/eng/Packages.props ++++ b/eng/Packages.props +@@ -40,6 +40,7 @@ + + + ++ + + + +diff --git a/src/Directory.Build.props b/src/Directory.Build.props +index 54b620c6..0100afd5 100644 +--- a/src/Directory.Build.props ++++ b/src/Directory.Build.props +@@ -27,13 +27,12 @@ + + + $(FullFrameworkTFM);netstandard2.0 +- netstandard2.0 + $(FullFrameworkTFM) + AnyCPU + + + netcoreapp2.1 +- $(FullFrameworkTFM);$(RuntimeOutputTargetFrameworks) ++ $(FullFrameworkTFM);$(RuntimeOutputTargetFrameworks) + $(FullFrameworkTFM) + + +diff --git a/src/Utilities/Microsoft.Build.Utilities.csproj b/src/Utilities/Microsoft.Build.Utilities.csproj +index 840d2bcc..78f84687 100644 +--- a/src/Utilities/Microsoft.Build.Utilities.csproj ++++ b/src/Utilities/Microsoft.Build.Utilities.csproj +@@ -39,6 +39,10 @@ + + + ++ ++ ++ ++ + + + Shared\AssemblyFolders\AssemblyFoldersEx.cs +-- +2.18.0 + diff --git a/patches/runtime/0033-Build-net4-in-source-build.patch b/patches/runtime/0033-Build-net4-in-source-build.patch deleted file mode 100644 index 6bba48f53d..0000000000 --- a/patches/runtime/0033-Build-net4-in-source-build.patch +++ /dev/null @@ -1,96 +0,0 @@ -From e4813ac3c2260a370e196acaa09a19e77aacbe0e Mon Sep 17 00:00:00 2001 -From: Davis Goodin -Date: Wed, 9 Dec 2020 14:01:09 -0600 -Subject: [PATCH] Build net4* in source-build - -Build net4XX TFMs to support OmniSharp. OmniSharp uses Mono, which needs to be -able to find net4XX binaries. See https://github.com/OmniSharp/omnisharp-roslyn/issues/1973 - -This patch moves the list of all net4XX TFMs (except net48) that was already -present in dotnet/runtime into a property called -"NETFrameworkTargetFrameworksExcept48". The list is missing net48 because -dotnet/runtime uses this list to automatically build non-net48 TFMs when the dev -specifies net48. Source-build reuses this variable to build all the net4XX TFMs -for source-build. (net48 is added individually to fill the gap.) If this patch -hits a conflict due to the list of TFMs changing, make sure that every net4XX -TFM ends up in AdditionalBuildTargetFrameworks during source-build. - -The patch also removes some ref/[...].csproj ProjectReferences to avoid build -errors like these: - - /work/artifacts/src/runtime.cf258a14b70ad9069470a108f13765e0e5988f51/src/libraries/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.cs(1383,140): - error CS0433: The type 'PermissionSet' exists in both 'System.Security.Permissions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' and 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' [/work/artifacts/src/runtime.cf258a14b70ad9069470a108f13765e0e5988f51/src/libraries/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.csproj] - /work/artifacts/src/runtime.cf258a14b70ad9069470a108f13765e0e5988f51/src/libraries/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.cs(1471,125): - error CS0433: The type 'PermissionSet' exists in both 'System.Security.Permissions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' and 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' [/work/artifacts/src/runtime.cf258a14b70ad9069470a108f13765e0e5988f51/src/libraries/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.csproj] - /work/.dotnet/sdk/5.0.100-rc.1.20452.10/Microsoft.Common.CrossTargeting.targets(88,5): error MSB4181: The "MSBuild" task returned false but did not log an error. [/work/artifacts/src/runtime.cf258a14b70ad9069470a108f13765e0e5988f51/src/libraries/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.csproj] - /work/artifacts/src/runtime.cf258a14b70ad9069470a108f13765e0e5988f51/src/libraries/System.ServiceProcess.ServiceController/ref/System.ServiceProcess.ServiceController.cs(39,43): - error CS0433: The type 'EventLog' exists in both 'System.Diagnostics.EventLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' and 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' [/work/artifacts/src/runtime.cf258a14b70ad9069470a108f13765e0e5988f51/src/libraries/System.ServiceProcess.ServiceController/ref/System.ServiceProcess.ServiceController.csproj] - /work/.dotnet/sdk/5.0.100-rc.1.20452.10/Microsoft.Common.CrossTargeting.targets(88,5): error MSB4181: The "MSBuild" task returned false but did not log an error. [/work/artifacts/src/runtime.cf258a14b70ad9069470a108f13765e0e5988f51/src/libraries/System.ServiceProcess.ServiceController/ref/System.ServiceProcess.ServiceController.csproj] - ---- - src/libraries/Directory.Build.props | 5 +++-- - .../src/Microsoft.Extensions.Configuration.Xml.csproj | 3 +++ - .../ref/System.Configuration.ConfigurationManager.csproj | 2 +- - .../ref/System.ServiceProcess.ServiceController.csproj | 2 +- - 4 files changed, 8 insertions(+), 4 deletions(-) - -diff --git a/src/libraries/Directory.Build.props b/src/libraries/Directory.Build.props -index 7a3946c28a4..dfe161d6d72 100644 ---- a/src/libraries/Directory.Build.props -+++ b/src/libraries/Directory.Build.props -@@ -41,8 +41,9 @@ - Debug - $(TargetFramework) - -- net45;net451;net452;net46;net461;net462;net47;net471;net472 -- $(AdditionalBuildTargetFrameworks);netstandard2.0 -+ net45;net451;net452;net46;net461;net462;net47;net471;net472 -+ $(AdditionalBuildTargetFrameworks);$(NETFrameworkTargetFrameworksExcept48) -+ $(AdditionalBuildTargetFrameworks);netstandard2.0;net48;$(NETFrameworkTargetFrameworksExcept48) - $(BuildTargetFramework)-$(TargetOS)-$(Configuration)-$(TargetArchitecture) - $(NetCoreAppCurrent)-$(TargetOS)-$(Configuration)-$(TargetArchitecture) - -diff --git a/src/libraries/Microsoft.Extensions.Configuration.Xml/src/Microsoft.Extensions.Configuration.Xml.csproj b/src/libraries/Microsoft.Extensions.Configuration.Xml/src/Microsoft.Extensions.Configuration.Xml.csproj -index e1dad4a470d..ac14aaad7d6 100644 ---- a/src/libraries/Microsoft.Extensions.Configuration.Xml/src/Microsoft.Extensions.Configuration.Xml.csproj -+++ b/src/libraries/Microsoft.Extensions.Configuration.Xml/src/Microsoft.Extensions.Configuration.Xml.csproj -@@ -10,6 +10,9 @@ - - - -+ -+ -+ - - - -diff --git a/src/libraries/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.csproj b/src/libraries/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.csproj -index 4adc0b2edb5..66d4e2aa47d 100644 ---- a/src/libraries/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.csproj -+++ b/src/libraries/System.Configuration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.csproj -@@ -10,7 +10,7 @@ - - - -- -+ - - - -diff --git a/src/libraries/System.ServiceProcess.ServiceController/ref/System.ServiceProcess.ServiceController.csproj b/src/libraries/System.ServiceProcess.ServiceController/ref/System.ServiceProcess.ServiceController.csproj -index 50d5af47646..3451105192e 100644 ---- a/src/libraries/System.ServiceProcess.ServiceController/ref/System.ServiceProcess.ServiceController.csproj -+++ b/src/libraries/System.ServiceProcess.ServiceController/ref/System.ServiceProcess.ServiceController.csproj -@@ -13,7 +13,7 @@ - - - -- -+ - - - -\ No newline at end of file --- -2.25.4 - diff --git a/repos/runtime.common.props b/repos/runtime.common.props index 97ceb231ee..b26f2aa09c 100644 --- a/repos/runtime.common.props +++ b/repos/runtime.common.props @@ -43,6 +43,7 @@ $(CoreClrBuildArguments) /p:NoPgoOptimize=true $(CoreClrBuildArguments) /p:KeepNativeSymbols=true + $(CoreClrBuildArguments) /p:BuildAllConfigurations=true $(CoreClrBuildArguments) /p:RuntimeOS=$(OverrideTargetRid.Substring(0, $(OverrideTargetRid.IndexOf("-")))) $(CoreClrBuildArguments) /p:RuntimeOS=$(OverrideTargetRid) @@ -62,6 +63,7 @@ $(LibrariesBuildArguments) /p:BuildAllPackages=true $(LibrariesBuildArguments) /p:BuildAllOOBPackages=true $(LibrariesBuildArguments) /p:KeepNativeSymbols=true + $(LibrariesBuildArguments) /p:BuildAllConfigurations=true $(LibrariesBuildArguments) /p:BuiltSdkPackageOverride="" $(LibrariesBuildArguments) /p:MicrosoftNETCoreDotNetHostPackageVersion=$(DOTNET_HOST_BOOTSTRAP_VERSION) $(LibrariesBuildArguments) /p:MicrosoftNETCoreDotNetHostPolicyPackageVersion=$(DOTNET_HOST_BOOTSTRAP_VERSION) @@ -75,6 +77,7 @@ $(InstallerBuildArguments) -cmakeargs -DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE $(InstallerBuildArguments) /p:TargetArchitecture=$(Platform) /p:DisableCrossgen=true /p:CrossBuild=true $(InstallerBuildArguments) /p:BuildDebPackage=false + $(InstallerBuildArguments) /p:BuildAllBuildAllConfigurations=true $(InstallerBuildArguments) /p:BuildAllPackages=true $(InstallerBuildArguments) /p:RestoreAllBuildRids=false $(InstallerBuildArguments) /p:OutputRid=$(OverrideTargetRid)