Skip to content

Commit

Permalink
msi: migrate to WiX4
Browse files Browse the repository at this point in the history
To be able to build x86, x64, and ARM64 MSI installers with the same WiX
version, migration to WiX4 is required.

PR-URL: #45943
Refs: nodejs/build#2540
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
  • Loading branch information
StefanStojanovic authored and RafaelGSS committed Apr 7, 2023
1 parent ef62e5a commit c03e79b
Show file tree
Hide file tree
Showing 13 changed files with 227 additions and 289 deletions.
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ _UpgradeReport_Files/
/tools/msvs/genfiles/
/npm.wxs
/corepack.wxs
/tools/msvs/msi/Release/
/tools/msvs/msi/obj/
/tools/msvs/msi/x64/
/tools/msvs/msi/**/Release/
/tools/msvs/msi/**/obj/
/tools/msvs/msi/**/x64/
# Exclude MSVS files used for .msi file generation
!tools/msvs/msi/custom_actions.vcxproj
!tools/msvs/msi/nodemsi.sln
!tools/msvs/msi/**/custom_actions.vcxproj
!tools/msvs/msi/**/nodemsi.sln

# === Rules for GYP artifacts ===
*-nodegyp*
Expand Down
5 changes: 1 addition & 4 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -586,10 +586,7 @@ to run it again before invoking `make -j4`.

Optional requirements to build the MSI installer package:

* The [WiX Toolset v3.11](https://wixtoolset.org/releases/) and the
[Wix Toolset Visual Studio 2019 Extension](https://marketplace.visualstudio.com/items?itemName=WixToolset.WixToolsetVisualStudio2019Extension)
* The [WiX Toolset v3.14](https://wixtoolset.org/releases/) if
building for Windows 10 on ARM (ARM64)
* The .NET SDK component from [Visual Studio 2019](https://visualstudio.microsoft.com/vs/older-downloads/#visual-studio-2019-and-other-products)

Optional requirements for compiling for Windows 10 on ARM (ARM64):

Expand Down
6 changes: 6 additions & 0 deletions tools/msvs/msi/NuGet.Config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -77,27 +77,6 @@ extern "C" UINT WINAPI SetInstallScope(MSIHANDLE hInstall) {
return WcaFinalize(ERROR_SUCCESS);
}


extern "C" UINT WINAPI BroadcastEnvironmentUpdate(MSIHANDLE hInstall) {
HRESULT hr = S_OK;
UINT er = ERROR_SUCCESS;

hr = WcaInitialize(hInstall, "BroadcastEnvironmentUpdate");
ExitOnFailure(hr, "Failed to initialize");

SendMessageTimeoutW(HWND_BROADCAST,
WM_SETTINGCHANGE,
0,
(LPARAM) L"Environment",
SMTO_ABORTIFHUNG,
5000,
NULL);

LExit:
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
return WcaFinalize(er);
}

#define AUTHENTICATED_USERS_SID L"S-1-5-11"

extern "C" UINT WINAPI GetLocalizedUserNames(MSIHANDLE hInstall) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ LIBRARY "custom_actions"

EXPORTS
SetInstallScope
BroadcastEnvironmentUpdate
GetLocalizedUserNames
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(WixSdkDir)\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(PkgWixToolset_WcaUtil)\build\native\include;$(PkgWixToolset_DUtil)\build\native\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
Expand All @@ -122,7 +122,7 @@
</ClCompile>
<Link>
<AdditionalDependencies>msi.lib;dutil.lib;wcautil.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(WixSdkDir)\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>$(PkgWixToolset_WcaUtil)\build\native\v14\x86;$(PkgWixToolset_DUtil)\build\native\v14\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ModuleDefinitionFile>custom_actions.def</ModuleDefinitionFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
Expand All @@ -131,7 +131,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(WixSdkDir)\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(PkgWixToolset_WcaUtil)\build\native\include;$(PkgWixToolset_DUtil)\build\native\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
Expand All @@ -141,7 +141,7 @@
</ClCompile>
<Link>
<AdditionalDependencies>msi.lib;dutil.lib;wcautil.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(WixSdkDir)\lib\ARM64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>$(PkgWixToolset_WcaUtil)\build\native\v14\ARM64;$(PkgWixToolset_DUtil)\build\native\v14\ARM64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ModuleDefinitionFile>custom_actions.def</ModuleDefinitionFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
Expand All @@ -150,7 +150,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(WixSdkDir)\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(PkgWixToolset_WcaUtil)\build\native\include;$(PkgWixToolset_DUtil)\build\native\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
Expand All @@ -160,7 +160,7 @@
</ClCompile>
<Link>
<AdditionalDependencies>msi.lib;dutil.lib;wcautil.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(WixSdkDir)\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>$(PkgWixToolset_WcaUtil)\build\native\v14\x64;$(PkgWixToolset_DUtil)\build\native\v14\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ModuleDefinitionFile>custom_actions.def</ModuleDefinitionFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
Expand All @@ -170,7 +170,7 @@
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(WixSdkDir)\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(PkgWixToolset_WcaUtil)\build\native\include;$(PkgWixToolset_DUtil)\build\native\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
Expand All @@ -184,7 +184,7 @@
</ClCompile>
<Link>
<AdditionalDependencies>msi.lib;dutil.lib;wcautil.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(WixSdkDir)\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>$(PkgWixToolset_WcaUtil)\build\native\v14\x86;$(PkgWixToolset_DUtil)\build\native\v14\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ModuleDefinitionFile>custom_actions.def</ModuleDefinitionFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
Expand All @@ -196,7 +196,7 @@
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(WixSdkDir)\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(PkgWixToolset_WcaUtil)\build\native\include;$(PkgWixToolset_DUtil)\build\native\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
Expand All @@ -210,7 +210,7 @@
</ClCompile>
<Link>
<AdditionalDependencies>msi.lib;dutil.lib;wcautil.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(WixSdkDir)\lib\ARM64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>$(PkgWixToolset_WcaUtil)\build\native\v14\ARM64;$(PkgWixToolset_DUtil)\build\native\v14\ARM64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ModuleDefinitionFile>custom_actions.def</ModuleDefinitionFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
Expand All @@ -222,7 +222,7 @@
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(WixSdkDir)\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(PkgWixToolset_WcaUtil)\build\native\include;$(PkgWixToolset_DUtil)\build\native\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
Expand All @@ -236,7 +236,7 @@
</ClCompile>
<Link>
<AdditionalDependencies>msi.lib;dutil.lib;wcautil.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(WixSdkDir)\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>$(PkgWixToolset_WcaUtil)\build\native\v14\x64;$(PkgWixToolset_DUtil)\build\native\v14\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ModuleDefinitionFile>custom_actions.def</ModuleDefinitionFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
Expand All @@ -254,4 +254,12 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<ItemGroup>
<PackageReference Include="WixToolset.WcaUtil" Version="4.0.0-rc.1" GeneratePathProperty="true" />
<PackageReference Include="WixToolset.DUtil" Version="4.0.0-rc.1" GeneratePathProperty="true" />
</ItemGroup>
<PropertyGroup>
<_NuGetTargetFallbackMoniker>$(_NuGetTargetFallbackMoniker);native,Version=v0.0</_NuGetTargetFallbackMoniker>
<RuntimeIdentifiers>$(RuntimeIdentifiers);win-arm64</RuntimeIdentifiers>
</PropertyGroup>
</Project>
43 changes: 0 additions & 43 deletions tools/msvs/msi/i18n/en-us.wxl

This file was deleted.

17 changes: 12 additions & 5 deletions tools/msvs/msi/nodemsi.sln
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "nodemsi", "nodemsi.wixproj", "{1D808FF0-B5A9-4BE9-859D-B334B6F48BE2}"
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.33027.164
MinimumVisualStudioVersion = 10.0.40219.1
Project("{B7DD6F7E-DEF8-4E67-B5B7-07EF123DB6F0}") = "nodemsi", "nodemsi\nodemsi.wixproj", "{1D808FF0-B5A9-4BE9-859D-B334B6F48BE2}"
ProjectSection(ProjectDependencies) = postProject
{B70585F8-DAB7-40FA-9904-13CF53A73A06} = {B70585F8-DAB7-40FA-9904-13CF53A73A06}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "custom_actions", "custom_actions.vcxproj", "{B70585F8-DAB7-40FA-9904-13CF53A73A06}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "custom_actions", "custom_actions\custom_actions.vcxproj", "{B70585F8-DAB7-40FA-9904-13CF53A73A06}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -43,4 +47,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FB650322-7A09-471D-A635-F2DBDCEECDB8}
EndGlobalSection
EndGlobal
Loading

0 comments on commit c03e79b

Please sign in to comment.