diff --git a/DEVGUIDE.md b/DEVGUIDE.md index 041ce4a3391..0f1a3e4c376 100644 --- a/DEVGUIDE.md +++ b/DEVGUIDE.md @@ -192,7 +192,7 @@ For **Release**: #### Notes on the Windows .NET Framework build -1. The `update.cmd` script NGens the compiler and libraries. This requires admin privileges. +1. The `update.cmd` script adds required strong name validation skips and NGens the compiler and libraries. This requires admin privileges. 1. The compiler binaries produced are "private" and strong-named signed with a test key. 1. Some additional tools are required to build the compiler, notably `fslex.exe`, `fsyacc.exe`, `FSharp.PowerPack.Build.Tasks.dll`, `FsSrGen.exe`, `FSharp.SRGen.Build.Tasks.dll`, and the other tools found in the `lkg` directory. 1. The overall bootstrapping process executes as follows diff --git a/build.cmd b/build.cmd index e608ae0273e..4a45c333df6 100644 --- a/build.cmd +++ b/build.cmd @@ -497,6 +497,8 @@ if "%RestorePackages%"=="" ( @echo VSSDKToolsPath: %VSSDKToolsPath% @echo VSSDKIncludes: %VSSDKIncludes% +@call src\update.cmd signonly + :: Check prerequisites if not "%VisualStudioVersion%" == "" goto vsversionset if exist "%VS150COMNTOOLS%\..\ide\devenv.exe" set VisualStudioVersion=15.0 @@ -702,12 +704,16 @@ set PATH=%PATH%;%CORDIR% set REGEXE32BIT=reg.exe +IF NOT DEFINED SNEXE32 IF EXIST "%WINSDKNETFXTOOLS%\sn.exe" set SNEXE32=%WINSDKNETFXTOOLS%sn.exe +IF NOT DEFINED SNEXE64 IF EXIST "%WINSDKNETFXTOOLS%x64\sn.exe" set SNEXE64=%WINSDKNETFXTOOLS%x64\sn.exe IF NOT DEFINED ildasm IF EXIST "%WINSDKNETFXTOOLS%\ildasm.exe" set ildasm=%WINSDKNETFXTOOLS%ildasm.exe echo. echo SDK environment vars echo ======================= echo WINSDKNETFXTOOLS: %WINSDKNETFXTOOLS% +echo SNEXE32: %SNEXE32% +echo SNEXE64: %SNEXE64% echo ILDASM: %ILDASM% echo diff --git a/fcs/FSharp.Compiler.Service.Tests.netcore/FSharp.Compiler.Service.Tests.netcore.fsproj b/fcs/FSharp.Compiler.Service.Tests.netcore/FSharp.Compiler.Service.Tests.netcore.fsproj index 9ec065c1c2b..71f5341bb71 100644 --- a/fcs/FSharp.Compiler.Service.Tests.netcore/FSharp.Compiler.Service.Tests.netcore.fsproj +++ b/fcs/FSharp.Compiler.Service.Tests.netcore/FSharp.Compiler.Service.Tests.netcore.fsproj @@ -4,7 +4,7 @@ $(DefineConstants);DOTNETCORE;FX_ATLEAST_45;FX_ATLEAST_PORTABLE;FX_NO_RUNTIMEENVIRONMENT;FX_RESHAPED_REFLECTION;TODO_REWORK_ASSEMBLY_LOAD; $(NoWarn);44; true - true + true true false diff --git a/fcs/FSharp.Compiler.Service.netstandard/FSharp.Compiler.Service.netstandard.fsproj b/fcs/FSharp.Compiler.Service.netstandard/FSharp.Compiler.Service.netstandard.fsproj index 6423180680a..0ebd29eea3d 100644 --- a/fcs/FSharp.Compiler.Service.netstandard/FSharp.Compiler.Service.netstandard.fsproj +++ b/fcs/FSharp.Compiler.Service.netstandard/FSharp.Compiler.Service.netstandard.fsproj @@ -67,7 +67,7 @@ $(DefineConstants);TODO_REWORK_SERVER $(NoWarn);44;69;65;54;61;75;62;9;2003; true - true + true true diff --git a/src/FSharpSource.Settings.targets b/src/FSharpSource.Settings.targets index feb2626741c..75071b1ca49 100644 --- a/src/FSharpSource.Settings.targets +++ b/src/FSharpSource.Settings.targets @@ -60,7 +60,7 @@ true $(FSharpSourcesRoot)\fsharp\msft.pubkey true - true + true diff --git a/src/FSharpSource.targets b/src/FSharpSource.targets index 52fcb8bb2cf..844848dc4c7 100644 --- a/src/FSharpSource.targets +++ b/src/FSharpSource.targets @@ -29,9 +29,8 @@ - $(OtherFlags) --publicsign+ + true true - true $(FSCoreVersion) 15.4.1.0 @@ -46,8 +45,7 @@ true $(FSharpSourcesRoot)\fsharp\msft.pubkey true - true - true + true $(FSCoreVersion) fs diff --git a/src/update.cmd b/src/update.cmd index af18a82b560..87f79130ac1 100644 --- a/src/update.cmd +++ b/src/update.cmd @@ -6,8 +6,9 @@ if /i "%1" == "debug" goto :ok if /i "%1" == "release" goto :ok +if /i "%1" == "signonly" goto :ok -echo NGening built binaries +echo adding required strong name verification skipping and NGening built binaries echo Usage: echo update.cmd debug [-ngen] echo update.cmd release [-ngen] @@ -37,9 +38,20 @@ if "%WINSDKNETFXTOOLS_x86%"=="" FOR /F "tokens=2* delims= " %%A IN ('%REGEXE32B set WINSDKNETFXTOOLS_x64=%WINSDKNETFXTOOLS_x86%x64\ :havesdk +set SN32="%WINSDKNETFXTOOLS_x86%sn.exe" +set SN64="%WINSDKNETFXTOOLS_x64%sn.exe" + set NGEN32=%windir%\Microsoft.NET\Framework\v4.0.30319\ngen.exe set NGEN64=%windir%\Microsoft.NET\Framework64\v4.0.30319\ngen.exe +rem Disable strong-name validation for binaries that are delay-signed with the microsoft key +%SN32% -q -Vr *,b03f5f7f11d50a3a + +if /i "%PROCESSOR_ARCHITECTURE%"=="AMD64" ( + %SN64% -q -Vr *,b03f5f7f11d50a3a +) + +if /i "%1" == "signonly" goto :eof if /i "%1" == "debug" set NGEN_FLAGS=/Debug rem NGen fsc, fsi, fsiAnyCpu, and FSharp.Build.dll diff --git a/vsintegration/update-vsintegration.cmd b/vsintegration/update-vsintegration.cmd index 022b288c0ab..35dd8014330 100644 --- a/vsintegration/update-vsintegration.cmd +++ b/vsintegration/update-vsintegration.cmd @@ -153,6 +153,8 @@ if "%WINSDKNETFXTOOLS%"=="" FOR /F "tokens=2* delims= " %%A IN ('%REGEXE32BIT% if "%WINSDKNETFXTOOLS%"=="" FOR /F "tokens=2* delims= " %%A IN ('%REGEXE32BIT% QUERY "HKLM\Software\Microsoft\Microsoft SDKs\Windows\v7.1\WinSDK-NetFx40Tools" /v InstallationFolder 2^>NUL') DO SET WINSDKNETFXTOOLS=%%B if "%WINSDKNETFXTOOLS%"=="" FOR /F "tokens=2* delims= " %%A IN ('%REGEXE32BIT% QUERY "HKLM\Software\Microsoft\Microsoft SDKs\Windows\v7.0A\WinSDK-NetFx40Tools" /v InstallationFolder 2^>NUL') DO SET WINSDKNETFXTOOLS=%%B +set SN32="%WINSDKNETFXTOOLS%sn.exe" +set SN64="%WINSDKNETFXTOOLS%x64\sn.exe" set NGEN32=%windir%\Microsoft.NET\Framework\v4.0.30319\ngen.exe set NGEN64=%windir%\Microsoft.NET\Framework64\v4.0.30319\ngen.exe @@ -326,6 +328,46 @@ if "%DEPLOY%" == "yes" if "!ISADMIN!" == "yes" ( REG ADD "HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\F# !FSHARPVERSION! Core Assemblies (Open Source)" /ve /t REG_SZ /f /d "!X86_PROGRAMFILES!\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.!FSHARPVERSION!.0\ REG ADD "HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.50709\AssemblyFoldersEx\F# !FSHARPVERSION! Core Assemblies (Open Source)" /ve /t REG_SZ /f /d "!X86_PROGRAMFILES!\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.!FSHARPVERSION!.0\ + rem Disable strong-name validation for F# binaries built from open source that are signed with the microsoft key + echo. + CALL :colorEcho 02 "[!ACTION!] Removing strong-name validation of F# binaries" & echo. + !SN32! -Vr FSharp.Core,b03f5f7f11d50a3a 1>NUL 2>NUL + !SN32! -Vr FSharp.Build,b03f5f7f11d50a3a 1>NUL 2>NUL + !SN32! -Vr FSharp.Compiler.Interactive.Settings,b03f5f7f11d50a3a 1>NUL 2>NUL + !SN32! -Vr HostedCompilerServer,b03f5f7f11d50a3a 1>NUL 2>NUL + + !SN32! -Vr FSharp.Compiler,b03f5f7f11d50a3a 1>NUL 2>NUL + !SN32! -Vr FSharp.Compiler.Server.Shared,b03f5f7f11d50a3a 1>NUL 2>NUL + !SN32! -Vr FSharp.Editor,b03f5f7f11d50a3a 1>NUL 2>NUL + !SN32! -Vr FSharp.LanguageService,b03f5f7f11d50a3a 1>NUL 2>NUL + !SN32! -Vr FSharp.LanguageService.Base,b03f5f7f11d50a3a 1>NUL 2>NUL + !SN32! -Vr FSharp.ProjectSystem.Base,b03f5f7f11d50a3a 1>NUL 2>NUL + !SN32! -Vr FSharp.ProjectSystem.FSharp,b03f5f7f11d50a3a 1>NUL 2>NUL + !SN32! -Vr FSharp.ProjectSystem.PropertyPages,b03f5f7f11d50a3a 1>NUL 2>NUL + !SN32! -Vr FSharp.VS.FSI,b03f5f7f11d50a3a 1>NUL 2>NUL + !SN32! -Vr VisualFSharp.Unittests,b03f5f7f11d50a3a 1>NUL 2>NUL + !SN32! -Vr VisualFSharp.Salsa,b03f5f7f11d50a3a 1>NUL 2>NUL + + REM Do this *in addition* to the above for x64 systems + if /i "!PROCESSOR_ARCHITECTURE!"=="AMD64" ( + !SN64! -Vr FSharp.Core,b03f5f7f11d50a3a 1>NUL 2>NUL + !SN64! -Vr FSharp.Build,b03f5f7f11d50a3a 1>NUL 2>NUL + !SN64! -Vr FSharp.Compiler.Interactive.Settings,b03f5f7f11d50a3a 1>NUL 2>NUL + !SN64! -Vr HostedCompilerServer,b03f5f7f11d50a3a 1>NUL 2>NUL + + !SN64! -Vr FSharp.Compiler,b03f5f7f11d50a3a 1>NUL 2>NUL + !SN64! -Vr FSharp.Compiler.Server.Shared,b03f5f7f11d50a3a 1>NUL 2>NUL + !SN64! -Vr FSharp.Editor,b03f5f7f11d50a3a 1>NUL 2>NUL + !SN64! -Vr FSharp.LanguageService,b03f5f7f11d50a3a 1>NUL 2>NUL + !SN64! -Vr FSharp.LanguageService.Base,b03f5f7f11d50a3a 1>NUL 2>NUL + !SN64! -Vr FSharp.ProjectSystem.Base,b03f5f7f11d50a3a 1>NUL 2>NUL + !SN64! -Vr FSharp.ProjectSystem.FSharp,b03f5f7f11d50a3a 1>NUL 2>NUL + !SN64! -Vr FSharp.ProjectSystem.PropertyPages,b03f5f7f11d50a3a 1>NUL 2>NUL + !SN64! -Vr FSharp.VS.FSI,b03f5f7f11d50a3a 1>NUL 2>NUL + !SN64! -Vr VisualFSharp.Unittests,b03f5f7f11d50a3a 1>NUL 2>NUL + !SN64! -Vr VisualFSharp.Salsa,b03f5f7f11d50a3a 1>NUL 2>NUL + ) + rem NGen fsc, fsi, fsiAnyCpu, and FSharp.Build.dll echo. @@ -358,6 +400,46 @@ if "%DEPLOY%" == "yes" if "!ISADMIN!" == "no" ( rem Re-enable certain settings when restoring, NGEN the original files again, requires admin rights if "%ACTION%" == "restore" if "!ISADMIN!" == "yes" ( + rem Re-enable strong-name validation for F# binaries that were previously installed + echo. + CALL :colorEcho 02 "[!ACTION!] Re-enabling strong-name validation of original F# binaries" & echo. + !SN32! -Vu FSharp.Core,b03f5f7f11d50a3a 2>NUL 1>NUL + !SN32! -Vu FSharp.Build,b03f5f7f11d50a3a 2>NUL 1>NUL + !SN32! -Vu FSharp.Compiler.Interactive.Settings,b03f5f7f11d50a3a 2>NUL 1>NUL + !SN32! -Vu HostedCompilerServer,b03f5f7f11d50a3a 2>NUL 1>NUL + + !SN32! -Vu FSharp.Compiler,b03f5f7f11d50a3a 2>NUL 1>NUL + !SN32! -Vu FSharp.Compiler.Server.Shared,b03f5f7f11d50a3a 2>NUL 1>NUL + !SN32! -Vu FSharp.Editor,b03f5f7f11d50a3a 2>NUL 1>NUL + !SN32! -Vu FSharp.LanguageService,b03f5f7f11d50a3a 2>NUL 1>NUL + !SN32! -Vu FSharp.LanguageService.Base,b03f5f7f11d50a3a 2>NUL 1>NUL + !SN32! -Vu FSharp.ProjectSystem.Base,b03f5f7f11d50a3a 2>NUL 1>NUL + !SN32! -Vu FSharp.ProjectSystem.FSharp,b03f5f7f11d50a3a 2>NUL 1>NUL + !SN32! -Vu FSharp.ProjectSystem.PropertyPages,b03f5f7f11d50a3a 2>NUL 1>NUL + !SN32! -Vu FSharp.VS.FSI,b03f5f7f11d50a3a 2>NUL 1>NUL + !SN32! -Vu VisualFSharp.Unittests,b03f5f7f11d50a3a 2>NUL 1>NUL + !SN32! -Vu VisualFSharp.Salsa,b03f5f7f11d50a3a 2>NUL 1>NUL + + REM Do this *in addition* to the above for x64 systems + if /i "!PROCESSOR_ARCHITECTURE!"=="AMD64" ( + !SN64! -Vu FSharp.Core,b03f5f7f11d50a3a 2>NUL 1>NUL + !SN64! -Vu FSharp.Build,b03f5f7f11d50a3a 2>NUL 1>NUL + !SN64! -Vu FSharp.Compiler.Interactive.Settings,b03f5f7f11d50a3a 2>NUL 1>NUL + !SN64! -Vu HostedCompilerServer,b03f5f7f11d50a3a 2>NUL 1>NUL + + !SN64! -Vu FSharp.Compiler,b03f5f7f11d50a3a 2>NUL 1>NUL + !SN64! -Vu FSharp.Compiler.Server.Shared,b03f5f7f11d50a3a 2>NUL 1>NUL + !SN64! -Vu FSharp.Editor,b03f5f7f11d50a3a 2>NUL 1>NUL + !SN64! -Vu FSharp.LanguageService,b03f5f7f11d50a3a 2>NUL 1>NUL + !SN64! -Vu FSharp.LanguageService.Base,b03f5f7f11d50a3a 2>NUL 1>NUL + !SN64! -Vu FSharp.ProjectSystem.Base,b03f5f7f11d50a3a 2>NUL 1>NUL + !SN64! -Vu FSharp.ProjectSystem.FSharp,b03f5f7f11d50a3a 2>NUL 1>NUL + !SN64! -Vu FSharp.ProjectSystem.PropertyPages,b03f5f7f11d50a3a 2>NUL 1>NUL + !SN64! -Vu FSharp.VS.FSI,b03f5f7f11d50a3a 2>NUL 1>NUL + !SN64! -Vu VisualFSharp.Unittests,b03f5f7f11d50a3a 2>NUL 1>NUL + !SN64! -Vu VisualFSharp.Salsa,b03f5f7f11d50a3a 2>NUL 1>NUL + ) + rem NGen fsc, fsi, fsiAnyCpu, and FSharp.Build.dll echo.