Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions assets/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
<!-- Default value of Checkbox of starting PowerShell after installation -->
<Property Id="WixShellExecTarget" Value="[$(var.ProductVersionWithName)]pwsh.exe"/>
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
<CustomAction Id="SaveShortcutPath" Property="ShortcutPath" Value="[$ApplicationProgramsMenuShortcut]$(var.ProductSemanticVersionWithNameAndOptionalArchitecture).lnk" />
<CustomAction Id="FixShortcutWorkingDirectory" Script="vbscript" HideTarget="no" Impersonate="no">
shortcutPath = Session.Property("ShortcutPath")
<CustomAction Id="SaveShortcutPath" Property="FixShortcutWorkingDirectory" Value="[$ApplicationProgramsMenuShortcut]$(var.ProductSemanticVersionWithNameAndOptionalArchitecture).lnk" />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need rename ShortcutPath to FixShortcutWorkingDirectory?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The property name must match the ID of the custom action in order to populate CustomActionData.

https://stackoverflow.com/questions/11233267/how-to-pass-customactiondata-to-a-customaction-using-wix

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarify! It is not obvious. Please add the comment with the link.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that WiX is not self-explanatory or intuitive to learn but do we really need to document basic WiX stuff here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somebody can change the name. We haven't msi package tests. So I'd prefer a protective comment.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I'd use SetShortcutWorkingDirectory name.

<CustomAction Id="FixShortcutWorkingDirectory" Script="vbscript" HideTarget="no" Impersonate="no" Execute="deferred" >
shortcutPath = Session.Property("CustomActionData")
Set fso = CreateObject("Scripting.FileSystemObject")
if (fso.FileExists(shortcutPath)) Then
Set wshShell = CreateObject("WSCript.Shell")
Expand Down Expand Up @@ -198,8 +198,8 @@
</Directory>
</Directory>
<InstallExecuteSequence>
<Custom Action="SaveShortcutPath" After="InstallFinalize" />
<Custom Action="FixShortcutWorkingDirectory" After="SaveShortcutPath">
<Custom Action="SaveShortcutPath" Before="FixShortcutWorkingDirectory" />
<Custom Action="FixShortcutWorkingDirectory" Before="InstallFinalize">
Copy link
Contributor

@bergmeister bergmeister Feb 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this style hard to read/maintain. It should be OK to run it e.g. just after InstallFiles and would make it more readable:

<Custom Action="SaveShortcutPath" After="InstallFiles" />
<Custom Action="FixShortcutWorkingDirectory" After="SaveShortcutPath">
```
This is just personal preference, so feel free to interpret it how you like (i.e. this is not a 'you must do')

NOT Installed OR NOT REMOVE OR UPGRADINGPRODUCTCODE
</Custom>
</InstallExecuteSequence>
Expand Down