8000 MSI: Make sure that file components are patchable (#6303) · kalgiz/PowerShell@da905f8 · GitHub
[go: up one dir, main page]

Skip to content

Commit da905f8

Browse files
authored
MSI: Make sure that file components are patchable (PowerShell#6303)
MSI: Make sure that file components are patchable - avoid changing names and guids of components between builds as this prevents patch generation - This required submitting the file generated by heat - add code to make sure the generated file is not out of date
1 parent 20b0e9c commit da905f8

File tree

3 files changed

+2495
-20
lines changed

3 files changed

+2495
-20
lines changed

assets/Product.wxs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<?define ProductSemanticVersionWithNameAndOptionalArchitecture = "$(var.ProductName) $(env.ProductSemanticVersion) ($(sys.BUILDARCH))"?>
1717
<?define ExplorerContextMenuDialogText = "&$(var.ProductName) $(env.ProductSemanticVersion) ($(sys.BUILDARCH))"?>
1818
<?endif?>
19+
<?define ProductDirectoryName = "$(env.ProductDirectoryName)" ?>
1920
<?define ProductVersion = "$(env.ProductVersion)" ?>
2021
<?define ProductSemanticVersion = "$(env.ProductSemanticVersion)" ?>
2122
<?define ProductVersionWithName = "$(var.ProductName)_$(var.ProductVersion)"?>
@@ -41,13 +42,13 @@
4142
<WixVariable Id="WixUIInfoIco" Value="assets\WixUIInfoIco.bmp" />
4243
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Open $(env.ProductName)" />
4344
<!-- Default value of Checkbox of starting PowerShell after installation -->
44-
<Property Id="WixShellExecTarget" Value="[$(var.ProductVersionWithName)]pwsh.exe"/>
45+
<Property Id="WixShellExecTarget" Value="[$(var.ProductDirectoryName)]pwsh.exe"/>
4546
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
4647

4748
<SetProperty Id="RegisterManifest"
4849
Before="RegisterManifest"
4950
Sequence="execute"
50-
Value="&quot;[$(var.ProductVersionWithName)]pwsh.exe&quot; -NoProfile -ExecutionPolicy Bypass -File &quot;[$(var.ProductVersionWithName)]RegisterManifest.ps1&quot;" />
51+
Value="&quot;[$(var.ProductDirectoryName)]pwsh.exe&quot; -NoProfile -ExecutionPolicy Bypass -File &quot;[$(var.ProductDirectoryName)]RegisterManifest.ps1&quot;" />
5152
<CustomAction Id="RegisterManifest"
5253
BinaryKey="WixCA"
5354
DllEntry="CAQuietExec"
@@ -57,7 +58,7 @@
5758
<SetProperty Id="EnablePSRemoting"
5859
Before="EnablePSRemoting"
5960
Sequence="execute"
60-
Value="&quot;[$(var.ProductVersionWithName)]pwsh.exe&quot; -NoProfile -ExecutionPolicy Bypass -Command &quot;Enable-PSRemoting&quot;" />
61+
Value="&quot;[$(var.ProductDirectoryName)]pwsh.exe&quot; -NoProfile -ExecutionPolicy Bypass -Command &quot;Enable-PSRemoting&quot;" />
6162
<CustomAction Id="EnablePSRemoting"
6263
BinaryKey="WixCA"
6364
DllEntry="CAQuietExec"
@@ -109,7 +110,7 @@
109110
<UIRef Id="CustomWixUI_InstallDir" />
110111
<!-- Features are mandatory. Need At Least One. -->
111112
<Feature Id="ProductFeature" Title="PowerShell" Level="1">
112-
<ComponentGroupRef Id="$(var.ProductVersionWithName)"/>
113+
<ComponentGroupRef Id="$(var.ProductDirectoryName)"/>
113114
<ComponentRef Id="ProductVersionFolder"/>
114115
<ComponentRef Id="ApplicationProgramsMenuShortcut"/>
115116
<ComponentRef Id="RegistryEntries"/>
@@ -141,7 +142,7 @@
141142
<Directory Id="TARGETDIR" Name="SourceDir">
142143
<Directory Id="$(var.ProductProgFilesDir)">
143144
<Directory Id="INSTALLFOLDER" Name="PowerShell">
144-
<Directory Id="$(var.ProductVersionWithName)" Name="$(var.ProductSemanticVersion)">
145+
<Directory Id="$(var.ProductDirectoryName)" Name="$(var.ProductSemanticVersion)">
145146
<Component Id="ProductVersionFolder" Guid="{e1a7f05e-0cd6-4227-80a8-e4fb311f045c}">
146147
<CreateFolder/>
147148
</Component>
@@ -153,7 +154,7 @@
153154
</RegistryKey>
154155
<!-- register ourselves in application registry so can be started using just Win+R `pwsh.exe` -->
155156
<RegistryKey Root="HKLM" Key="Software\Microsoft\Windows\CurrentVersion\App Paths\pwsh.exe" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes">
156-
<RegistryValue Type="string" Value="[$(var.ProductVersionWithName)]pwsh.exe"/>
157+
<RegistryValue Type="string" Value="[$(var.ProductDirectoryName)]pwsh.exe"/>
157158
</RegistryKey>
158159
</Component>
159160
<!-- add ourselves to %PATH% so pwsh.exe can be started from Windows PowerShell or cmd.exe -->
@@ -167,42 +168,42 @@
167168
<!-- When clicking on background in Explorer -->
168169
<RegistryKey Root="HKCR" Key="Directory\Background\shell\$(var.ProductName)$(env.ProductSemanticVersion)$(sys.BUILDARCH)">
169170
<RegistryValue Type="string" Name="MUIVerb" Value="$(var.ExplorerContextMenuDialogText)"/>
170-
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductVersionWithName)]assets\Powershell_black.ico"/>
171+
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductDirectoryName)]assets\Powershell_black.ico"/>
171172
<RegistryValue Type="string" Name="ExtendedSubCommandsKey" Value="Directory\ContextMenus\$(var.ProductName)$(env.ProductSemanticVersion)$(sys.BUILDARCH)"/>
172173
</RegistryKey>
173174
<!-- When clicking on Drive in Explorer -->
174175
<RegistryKey Root="HKCR" Key="Drive\shell\$(var.ProductName)$(env.ProductSemanticVersion)$(sys.BUILDARCH)">
175176
<RegistryValue Type="string" Name="MUIVerb" Value="$(var.ExplorerContextMenuDialogText)"/>
176-
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductVersionWithName)]assets\Powershell_black.ico"/>
177+
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductDirectoryName)]assets\Powershell_black.ico"/>
177178
<RegistryValue Type="string" Name="ExtendedSubCommandsKey" Value="Directory\ContextMenus\$(var.ProductName)$(env.ProductSemanticVersion)$(sys.BUILDARCH)"/>
178179
</RegistryKey>
179180
<!-- When clicking on Desktop background in Explorer -->
180181
<RegistryKey Root="HKCR" Key="DesktopBackground\shell\$(var.ProductName)$(env.ProductSemanticVersion)$(sys.BUILDARCH)">
181182
<RegistryValue Type="string" Name="MUIVerb" Value="$(var.ExplorerContextMenuDialogText)"/>
182-
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductVersionWithName)]assets\Powershell_black.ico"/>
183+
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductDirectoryName)]assets\Powershell_black.ico"/>
183184
<RegistryValue Type="string" Name="ExtendedSubCommandsKey" Value="Directory\ContextMenus\$(var.ProductName)$(env.ProductSemanticVersion)$(sys.BUILDARCH)"/>
184185
</RegistryKey>
185186
<!-- When clicking on folder in Explorer -->
186187
<RegistryKey Root="HKCR" Key="Directory\shell\$(var.ProductName)$(env.ProductSemanticVersion)$(sys.BUILDARCH)">
187188
<RegistryValue Type="string" Name="MUIVerb" Value="$(var.ExplorerContextMenuDialogText)"/>
188-
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductVersionWithName)]assets\Powershell_black.ico"/>
189+
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductDirectoryName)]assets\Powershell_black.ico"/>
189190
<RegistryValue Type="string" Name="ExtendedSubCommandsKey" Value="Directory\ContextMenus\$(var.ProductName)$(env.ProductSemanticVersion)$(sys.BUILDARCH)"/>
190191
</RegistryKey>
191192
<!-- Sub menus to open PowerShell at the current location either as a normal shell or as Administrator -->
192193
<RegistryKey Root="HKCR" Key="Directory\ContextMenus\$(var.ProductName)$(env.ProductSemanticVersion)$(sys.BUILDARCH)\shell\open">
193194
<RegistryValue Type="string" Name="MUIVerb" Value="$(var.ExplorerContextSubMenuDialogText)"/>
194-
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductVersionWithName)]assets\Powershell_black.ico"/>
195+
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductDirectoryName)]assets\Powershell_black.ico"/>
195196
</RegistryKey>
196197
<RegistryKey Root="HKCR" Key="Directory\ContextMenus\$(var.ProductName)$(env.ProductSemanticVersion)$(sys.BUILDARCH)\shell\open\command">
197-
<RegistryValue Type="string" Value="[$(var.ProductVersionWithName)]pwsh.exe -NoExit -Command Set-Location -LiteralPath '%V'"/>
198+
<RegistryValue Type="string" Value="[$(var.ProductDirectoryName)]pwsh.exe -NoExit -Command Set-Location -LiteralPath '%V'"/>
198199
</RegistryKey>
199200
<RegistryKey Root="HKCR" Key="Directory\ContextMenus\$(var.ProductName)$(env.ProductSemanticVersion)$(sys.BUILDARCH)\shell\runas">
200201
<RegistryValue Type="string" Name="MUIVerb" Value="$(var.ExplorerContextSubMenuElevatedDialogText)"/>
201-
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductVersionWithName)]assets\Powershell_black.ico"/>
202+
<RegistryValue Type="string" Name="Icon" Value="[$(var.ProductDirectoryName)]assets\Powershell_black.ico"/>
202203
<RegistryValue Type="string" Value="" Name="HasLUAShield"/>
203204
</RegistryKey>
204205
<RegistryKey Root="HKCR" Key="Directory\ContextMenus\$(var.ProductName)$(env.ProductSemanticVersion)$(sys.BUILDARCH)\shell\runas\command">
205-
<RegistryValue Type="string" Value="[$(var.ProductVersionWithName)]pwsh.exe -NoExit -Command Set-Location -LiteralPath '%V'"/>
206+
<RegistryValue Type="string" Value="[$(var.ProductDirectoryName)]pwsh.exe -NoExit -Command Set-Location -LiteralPath '%V'"/>
206207
</RegistryKey>
207208
</Component>
208209
</Directory>
@@ -214,8 +215,8 @@
214215
<Shortcut Id="PowerShell_ProgramsMenuShortcut"
215216
Name="$(var.ProductSemanticVersionWithNameAndOptionalArchitecture)"
216217
Description="$(var.ProductSemanticVersionWithNameAndOptionalArchitecture)"
217-
Target="[$(var.ProductVersionWithName)]pwsh.exe"
218-
WorkingDirectory="$(var.ProductVersionWithName)"
218+
Target="[$(var.ProductDirectoryName)]pwsh.exe"
219+
WorkingDirectory="$(var.ProductDirectoryName)"
219220
Icon = "PowerShellExe.ico" />
220221
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
221222
<!-- HKMU is HKLM when installing perMachine and HKCU when installing perUser-->

0 commit comments

Comments
 (0)
0