Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Commit 8164b2f

Browse files
committed
windows/msi: more installer enhancements
Noteworthy installer improvements provided here: * Support in the Installer UI for not installing shortcuts. * Support in the Installer UI for choosing a custom install directory. * Command line support for not installing shortcuts (ADDDEFAULT=nodejs) * Command line support for custom install directory (INSTALLDIR=c:\tools\node)
1 parent e418df7 commit 8164b2f

File tree

3 files changed

+64
-26
lines changed

3 files changed

+64
-26
lines changed

tools/msvs/msi/WixUI_en-us.wxl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<WixLocalization Culture="en-us" xmlns="http://schemas.microsoft.com/wix/2006/localization">
3+
<String Id="InstallDirDlgDescription">Choose a custom location or click Next to install</String>
4+
</WixLocalization>

tools/msvs/msi/nodemsi.wixproj

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
1+
<?xml version="1.0" encoding="utf-8"?>
32
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
43
<PropertyGroup>
54
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -27,18 +26,21 @@
2726
<OutputPath>..\..\..\$(Configuration)\</OutputPath>
2827
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
2928
<DefineConstants>Debug;ProductVersion=$(NodeVersion);NoETW=$(NoETW);NoPerfCtr=$(NoPerfCtr);NPMSourceDir=..\..\..\deps\npm\;ProgramFilesFolderId=ProgramFiles64Folder</DefineConstants>
29+
<Cultures>en-US</Cultures>
3030
</PropertyGroup>
3131
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
3232
<OutputPath>..\..\..\$(Configuration)\</OutputPath>
3333
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
3434
<DefineConstants>Debug;ProductVersion=$(NodeVersion);NoETW=$(NoETW);NoPerfCtr=$(NoPerfCtr);NPMSourceDir=..\..\..\deps\npm\;ProgramFilesFolderId=ProgramFiles64Folder</DefineConstants>
3535
</PropertyGroup>
3636
<PropertyGroup>
37-
<EnableProjectHarvesting>True</EnableProjectHarvesting>
37+
<EnableProjectHarvesting>True</EnableProjectHarvesting>
3838
</PropertyGroup>
3939
<ItemGroup>
4040
<Compile Include="product.wxs" />
41-
<Compile Include="..\..\..\npm.wxs" />
41+
<Compile Include="..\..\..\npm.wxs">
42+
<Link>npm.wxs</Link>
43+
</Compile>
4244
</ItemGroup>
4345
<ItemGroup>
4446
<WixExtension Include="WixUIExtension">
@@ -50,9 +52,16 @@
5052
<Name>WiXUtilExtension</Name>
5153
</WixExtension>
5254
</ItemGroup>
55+
<ItemGroup>
56+
<EmbeddedResource Include="WixUI_en-us.wxl" />
57+
</ItemGroup>
5358
<Import Project="$(WixTargetsPath)" />
54-
<Target Name="BeforeBuild">
55-
<HeatDirectory ToolPath="$(WixToolPath)" Directory="..\..\..\deps\npm" PreprocessorVariable="var.NPMSourceDir" DirectoryRefId="NodeModulesFolder" ComponentGroupName="NPMFiles" GenerateGuidsNow="true" SuppressFragments="false" OutputFile="..\..\..\npm.wxs">
56-
</HeatDirectory>
57-
</Target>
58-
</Project>
59+
<Target Name="BeforeBuild">
60+
<HeatDirectory ToolPath="$(WixToolPath)" Directory="..\..\..\deps\npm" PreprocessorVariable="var.NPMSourceDir" DirectoryRefId="NodeModulesFolder" ComponentGroupName="NPMFiles" GenerateGuidsNow="true" SuppressFragments="false" OutputFile="..\..\..\npm.wxs">
61+
</HeatDirectory>
62+
</Target>
63+
<PropertyGroup>
64+
<PostBuildEvent>move !(TargetPath) $(TargetDir)\$(TargetFileName)
65+
move !(TargetPdbPath) $(TargetDir)\$(TargetPdbName)</PostBuildEvent>
66+
</PropertyGroup>
67+
</Project>

tools/msvs/msi/product.wxs

Lines changed: 42 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@
2525

2626
<Icon Id="node.exe" SourceFile="$(var.RepoDir)\src\res\node.ico"/>
2727
<Property Id="ARPPRODUCTICON" Value="node.exe" />
28+
<Property Id="ApplicationFolderName" Value="nodejs" />
29+
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
30+
31+
<Property Id="INSTALLDIR">
32+
<RegistrySearch Id='InstallPathRegistry' Type='raw'
33+
Root='HKCU' Key='SOFTWARE\Joyent\Node.js\Installer' Name='PreviousPath' />
34+
</Property>
2835

2936
<Directory Id="TARGETDIR" Name="SourceDir">
3037

@@ -33,7 +40,7 @@
3340
</Directory>
3441

3542
<Directory Id="$(var.ProgramFilesFolderId)">
36-
<Directory Id="APPLICATIONROOTDIRECTORY" Name="nodejs">
43+
<Directory Id="INSTALLDIR" Name="nodejs">
3744
<Directory Id="NodeModulesFolder" Name="node_modules">
3845
<Directory Id="NPMFolder" Name="npm">
3946
<Component Id="npmrc" Guid="55B2B03F-8F32-4D62-A54A-FA428615591D">
@@ -45,12 +52,12 @@
4552
<File Id="filenodeexe" KeyPath="yes" Source="$(var.SourceDir)\node.exe" />
4653
<?if $(var.NoETW) != 1 ?>
4754
<File Id="node_etw_provider_man" Name="node_etw_provider.man" Source="$(var.RepoDir)\src\res\node_etw_provider.man" >
48-
<util:EventManifest MessageFile="[APPLICATIONROOTDIRECTORY]node.exe" ResourceFile="[APPLICATIONROOTDIRECTORY]node.exe"/>
55+
<util:EventManifest MessageFile="[INSTALLDIR]node.exe" ResourceFile="[INSTALLDIR]node.exe"/>
4956
</File>
5057
<?endif?>
5158
<?if $(var.NoPerfCtr) != 1 ?>
5259
<File Id="node_perfctr_provider_man" Name="node_perfctr_provider.man" Source="$(var.RepoDir)\src\res\node_perfctr_provider.man" >
53-
<util:PerfCounterManifest ResourceFileDirectory="[APPLICATIONROOTDIRECTORY]"/>
60+
<util:PerfCounterManifest ResourceFileDirectory="[INSTALLDIR]"/>
5461
</File>
5562
<?endif?>
5663
<Environment Id="npm_env"
@@ -64,7 +71,7 @@
6471
Name="PATH"
6572
Part="last"
6673
System="yes"
67-
Value="[APPLICATIONROOTDIRECTORY]" />
74+
Value="[INSTALLDIR]" />
6875
</Component>
6976
<Component Id="npmcmd" Guid="31e9986d-74cd-44e1-878c-194d3e997d32">
7077
<File Id="filenpmcmd" KeyPath="yes" Source="$(var.NPMSourceDir)\bin\npm.cmd" />
@@ -80,13 +87,24 @@
8087
<Component Id="nodejsvars" Guid="*">
8188
<File Id="filenodejsvars" KeyPath="yes" Source="$(var.RepoDir)\tools\msvs\nodejsvars.bat" />
8289
</Component>
90+
<Component Id="noderegistry" Guid="*" >
91+
<RegistryKey Root="HKCU" Key="Software">
92+
<RegistryKey Key="Joyent">
93+
<RegistryKey Key="Node.js">
94+
<RegistryKey Key="Installer">
95+
<RegistryValue Name="PreviousPath" Type="string" Value="[INSTALLDIR]" KeyPath="yes" />
96+
</RegistryKey>
97+
</RegistryKey>
98+
</RegistryKey>
99+
</RegistryKey>
100+
</Component>
83101
</Directory>
84102
</Directory>
85103

86104
<Directory Id="AppDataFolder">
87105
<Directory Id="NPMAppData" Name="npm">
88106
<Component Id="npmappdata_folder" Guid="994B1F7F-60CD-4792-A96D-63BC7FFF29BF" Permanent="yes">
89-
<RegistryKey Action="none" Key="dummy" Root="HKCU" >
107+
<RegistryKey Key="dummy" Root="HKCU" >
90108
<RegistryValue Type="integer" Value="1" KeyPath="yes" />
91109
</RegistryKey >
92110
<CreateFolder/>
@@ -99,13 +117,13 @@
99117
<DirectoryRef Id="ApplicationProgramsFolder">
100118
<Component Id="ApplicationShortcut" Guid="9b1ab94a-8f54-4f19-a5c4-b890de474162">
101119
<Shortcut Id="ApplicationStartMenuShortcut" Name="Node.js"
102-
Description="$(var.ProductDescription)" Target="[APPLICATIONROOTDIRECTORY]node.exe"
103-
WorkingDirectory="APPLICATIONROOTDIRECTORY"/>
120+
Description="$(var.ProductDescription)" Target="[INSTALLDIR]node.exe"
121+
WorkingDirectory="INSTALLDIR"/>
104122
<Shortcut Id="NodePromptStartMenuShortcut" Name="Node.js command prompt"
105123
Description="Node.js Command Prompt" Target="[%ComSpec]"
106-
Arguments='/k "[APPLICATIONROOTDIRECTORY]nodejsvars.bat"'
124+
Arguments='/k "[INSTALLDIR]nodejsvars.bat"'
107125
Show="normal"
108-
WorkingDirectory="APPLICATIONROOTDIRECTORY"/>
126+
WorkingDirectory="INSTALLDIR"/>
109127
<Shortcut Id="UninstallProduct"
110128
Name="Uninstall Node.js"
111129
Target="[SystemFolder]msiexec.exe"
@@ -114,7 +132,7 @@
114132
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
115133
<RegistryValue Root="HKCU" Key="Software\Joyent\$(var.ProductName)" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
116134
</Component>
117-
<Component Id="InternetShortcuts" Guid="3351B877-49BA-4BC0-BF5E-21BA623FD07C">
135+
<Component Id="InternetShortcuts" Guid="3351B877-49BA-4BC0-BF5E-21BA623FD07C">
118136
<util:InternetShortcut Id="OnlineWebsiteShortcut"
119137
Name="Node.js website"
120138
Target="http://nodejs.org"
@@ -127,7 +145,6 @@
127145
</Component>
128146
</DirectoryRef>
129147

130-
131148
<ComponentGroup Id="allfiles">
132149
<ComponentRef Id="nodeexe"/>
133150
<ComponentRef Id="npmcmd"/>
@@ -139,6 +156,7 @@
139156
<ComponentRef Id="nodepdb"/>
140157
<?endif?>
141158
<ComponentRef Id="nodejsvars" />
159+
<ComponentRef Id="noderegistry" />
142160
</ComponentGroup>
143161

144162
<ComponentGroup Id="application.shortcuts">
@@ -154,11 +172,11 @@
154172
<ComponentGroupRef Id="Product.Generated" />
155173
</Feature>
156174

157-
<Feature Id="nodejs.shortcuts" Title="node.js shortcuts" Description="$(var.ProductDescription) Shortcuts">
158-
<Feature Id="feature.application.shortcuts" Title="Application Shortcuts" Level="1" Description="$(var.ProductDescription) standard application shortcuts">
175+
<Feature Id="nodejs.shortcuts" Title="node.js shortcuts" Level="1" Description="$(var.ProductDescription) Shortcuts">
176+
<Feature Id="nodejs.shortcuts.application" Title="Application Shortcuts" Level="1" Description="$(var.ProductDescription) standard application shortcuts">
159177
<ComponentGroupRef Id="application.shortcuts"/>
160178
</Feature>
161-
<Feature Id="feature.internet.shortcuts" Title="Internet Shortcuts" Level="1" Description="$(var.ProductDescription) internet shortcuts to the project's website and online documentation for this version">
179+
<Feature Id="nodejs.shortcuts.internet" Title="Internet Shortcuts" Level="1" Description="$(var.ProductDescription) internet shortcuts to the project's website and online documentation for this version">
162180
<ComponentGroupRef Id="internet.shortcuts"/>
163181
</Feature>
164182
</Feature>
@@ -181,11 +199,19 @@
181199
<DialogRef Id="UserExit" />
182200
<DialogRef Id="WelcomeDlg" />
183201
<DialogRef Id="LicenseAgreementDlg"/>
202+
<DialogRef Id="InstallDirDlg"/>
203+
<DialogRef Id="BrowseDlg"/>
204+
<DialogRef Id="InvalidDirDlg"/>
184205

185206
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="LicenseAgreementDlg">NOT Installed</Publish>
186207
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">Installed AND PATCH</Publish>
187208
<Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
188-
<Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="CustomizeDlg">LicenseAccepted = "1"</Publish>
209+
<Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg">LicenseAccepted = "1"</Publish>
210+
<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
211+
<Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="CustomizeDlg" Order="20">1</Publish>
212+
<Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="10">1</Publish>
213+
<Publish Dialog="InstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="10">1</Publish>
214+
<Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="20">1</Publish>
189215
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
190216
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="1">NOT Installed OR WixUI_InstallMode = "Change"</Publish>
191217
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed AND NOT PATCH</Publish>
@@ -196,12 +222,11 @@
196222
<Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
197223
<Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
198224
<Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="1">Installed</Publish>
199-
<Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg" Order="2">NOT Installed</Publish>
225+
<Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="InstallDirDlg" Order="2">NOT Installed</Publish>
200226
<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
201227

202228
<Property Id="ARPNOMODIFY" Value="1" />
203229
<Property Id="WIXUI_EXITDIALOGOPTIONALTEXT" Value="Node.js has been succesfully installed. To run Node.js open command prompt (cmd.exe), and run 'node'." />
204-
205230
</UI>
206231

207232
<UIRef Id="WixUI_Common" />

0 commit comments

Comments
 (0)