-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Fix shortcut script when installed with UAC on #6099
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| <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" /> |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|
cc @bergmeister |
|
I have tested this works when run via GUI or quiet install. However, I have some comments about the code:
|
| <Custom Action="SaveShortcutPath" After="InstallFinalize" /> | ||
| <Custom Action="FixShortcutWorkingDirectory" After="SaveShortcutPath"> | ||
| <Custom Action="SaveShortcutPath" Before="FixShortcutWorkingDirectory" /> | ||
| <Custom Action="FixShortcutWorkingDirectory" Before="InstallFinalize"> |
There was a problem hiding this comment.
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')
|
@bergmeister agree that we should leverage the exit code check and fail the install |
|
I think the exit code check should be a separate issue. There are many things to consider, such as what is Windows Script Host is disabled |
TravisEz13
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use SetShortcutWorkingDirectory for the name of the script custom action
|
Before the change MSI package fail but not revert (leave already copied files). |
Are you saying after this change, if the script fails the package fails? If so, perhaps we should revert this. Scripts can be unreliable and making it a critical part of the package doesn't seem like a good idea. |
|
We cannot predict what will cause the installer to crash. We can only confidently say that our installer will be enhanced in the future and such crash reasons will become more. In any case, we need to think about implementing |
|
We can predict it. Script actions have a high historical failure rate due to factors unrelated to the script |
|
So based on my research, the options are:
I'm open to other suggestions as well? |
|
First of all, I think we should revert commit 795c61125a531d62784e299a3159844b733e8a91 in the meantime (that's what source control is for), especially given the upcoming pre-release next week on 2/22.
About the specific problem: although it's hard to bootstrap custom C# actions the first time, I think they would be very welcome and helpful for future installer features (like e.g. PR 5999) |
|
I don't think plugin custom actions are more reliable than scripts. For example, if we lock a system using a GPO or third-party security product, we will get the same installation error. However, if we want an advanced installer, then definitely we should stick to one way of creating extensions and handling errors and I believe it will be C#. In this case, we must also have the installation tests. I think that first we need to define our strategy. |
|
@bergmeister @iSazonov
|
|
@TravisEz13 Commit 795c61125a531d62784e299a3159844b733e8a91 is still not reverted. Is someone stuck inside vim? 😜 |
|
#6203 has been submitted |
|
@gpduck Please resolve merge conflicts. |
|
This PR has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed if no further activity occurs within 10 days. Thank you for your contributions. |
|
I think we can close this for now. See #6099 (comment) |
PR Summary
Moves the working directory script to execute during the elevated portion of the install process to prevent access denied errors during install.
Fixes #6095
PR Checklist
Note: Please mark anything not applicable to this PR
NA.[feature]if the change is significant or affects feature testsWIP:to the beginning of the title and remove the prefix when the PR is ready.