From 87c885bd44e5c6c54ebe50324d3da76bfd9e094f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Reis?= Date: Fri, 17 Nov 2017 17:54:06 +0000 Subject: [PATCH] build,win,msi: support WiX with VS2017 PR-URL: https://github.com/nodejs/node/pull/17101 Reviewed-By: Nikolai Vavilov --- BUILDING.md | 2 ++ vcbuild.bat | 20 +++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index cd819b4b4779c7..e6d575f82737d5 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -209,6 +209,8 @@ Prerequisites: * Basic Unix tools required for some tests, [Git for Windows](http://git-scm.com/download/win) includes Git Bash and tools which can be included in the global `PATH`. +* **Optional** (to build the MSI): the [WiX Toolset v3.11](http://wixtoolset.org/releases/) + and the [Wix Toolset Visual Studio 2017 Extension](https://marketplace.visualstudio.com/items?itemName=RobMensching.WixToolsetVisualStudio2017Extension). If the path to your build directory contains a space, the build will likely fail. diff --git a/vcbuild.bat b/vcbuild.bat index a765bcb439b3c5..a15620e726680a 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -192,12 +192,24 @@ if %target_arch%==x64 if %msvs_host_arch%==amd64 set vcvarsall_arg=amd64 :vs-set-2017 if defined target_env if "%target_env%" NEQ "vs2017" goto vs-set-2015 echo Looking for Visual Studio 2017 +call tools\msvs\vswhere_usability_wrapper.cmd +if "_%VCINSTALLDIR%_" == "__" goto vs-set-2015 +if defined msi ( + echo Looking for WiX installation for Visual Studio 2017... + if not exist "%WIX%\SDK\VS2017" ( + echo Failed to find WiX install for Visual Studio 2017 + echo VS2017 support for WiX is only present starting at version 3.11 + goto vs-set-2015 + ) + if not exist "%VCINSTALLDIR%\..\MSBuild\Microsoft\WiX" ( + echo Failed to find the Wix Toolset Visual Studio 2017 Extension + goto vs-set-2015 + ) +) @rem check if VS2017 is already setup, and for the requested arch if "_%VisualStudioVersion%_" == "_15.0_" if "_%VSCMD_ARG_TGT_ARCH%_"=="_%target_arch%_" goto found_vs2017 @rem need to clear VSINSTALLDIR for vcvarsall to work as expected set "VSINSTALLDIR=" -call tools\msvs\vswhere_usability_wrapper.cmd -if "_%VCINSTALLDIR%_" == "__" goto vs-set-2015 @rem prevent VsDevCmd.bat from changing the current working directory set "VSCMD_START_DIR=%CD%" set vcvars_call="%VCINSTALLDIR%\Auxiliary\Build\vcvarsall.bat" %vcvarsall_arg% @@ -354,7 +366,9 @@ if not defined msi goto run :msibuild echo Building node-v%FULLVERSION%-%target_arch%.msi -msbuild "%~dp0tools\msvs\msi\nodemsi.sln" /m /t:Clean,Build /p:PlatformToolset=%PLATFORM_TOOLSET% /p:GypMsvsVersion=%GYP_MSVS_VERSION% /p:Configuration=%config% /p:Platform=%target_arch% /p:NodeVersion=%NODE_VERSION% /p:FullVersion=%FULLVERSION% /p:DistTypeDir=%DISTTYPEDIR% %noetw_msi_arg% %noperfctr_msi_arg% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo +set "msbsdk=" +if defined WindowsSDKVersion set "msbsdk=/p:WindowsTargetPlatformVersion=%WindowsSDKVersion:~0,-1%" +msbuild "%~dp0tools\msvs\msi\nodemsi.sln" /m /t:Clean,Build %msbsdk% /p:PlatformToolset=%PLATFORM_TOOLSET% /p:GypMsvsVersion=%GYP_MSVS_VERSION% /p:Configuration=%config% /p:Platform=%target_arch% /p:NodeVersion=%NODE_VERSION% /p:FullVersion=%FULLVERSION% /p:DistTypeDir=%DISTTYPEDIR% %noetw_msi_arg% %noperfctr_msi_arg% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo if errorlevel 1 goto exit if not defined sign goto upload