-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Conditionally set SYSTEM PATH in host install #118092
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
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.
Pull Request Overview
This PR adds conditional control over SYSTEM PATH modification during .NET host installer execution. The installer can now skip setting the SYSTEM PATH when a new registry key DisableSettingHostPath is set, supporting new SDK scenarios for managing user installs.
- Introduces registry-based control to disable SYSTEM PATH modification during installation
- Refactors PATH setting logic into a separate component with proper conditional checks
- Changes major upgrade scheduling to support compositional changes and rollback capabilities
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| host.wxs | Separates PATH setting into dedicated component with registry-based conditional logic and adds new registry search property |
| dotnet-host.proj | Updates major upgrade scheduling and adds new property to candle variables for build process |
Comments suppressed due to low confidence (1)
src/installer/pkg/sfx/installers/host.wxs:41
- [nitpick] The Component ID 'cmpPath' is inconsistent with the new component 'cmpSetPath' naming pattern. Consider renaming to 'cmpRegistryPath' or similar to clarify its purpose of setting registry values rather than PATH.
<Component Id="cmpPath" Directory="DOTNETHOME" Guid="*">
|
@agocke as an FYI. This is related to what we discussed last week. |
nagilson
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.
We should have someone who knows Wix review this PR, but the changes seem sound to me.
I can see some concern that going from afterInstallExecute to afterInstallInitialize may make the install fail if the uninstall failed (?) when it wouldn't have in the past, but given there's no good method for this change otherwise, I think it is justified. I would be surprised if install worked while uninstall did not, anywho.
The install would fail if the previous copy of the host failed to uninstall - that is already the case today. The only difference is that now, if rollback is allowed, it would reinstall the older product it failed to uninstall. I tested this using <CustomActionRef Id="WixFailWhenDeferred"/>
<SetProperty Id="WIXFAILWHENDEFERRED" Value="1" After="InstallInitialize" Sequence="execute">
UPGRADINGPRODUCTCODE
</SetProperty>So, you'll end up with the following. This is from |
Description
Conditionally turn off setting the SYSTEM PATH from the host installer. .NET supports a number of machine keys and values that determine how installers behave on Windows. This PR adds a new value under
HKLM\SOFTWARE\Microsoft\.NETnamedDisableSettingHostPath(typeREG_DWORD). When set to 1, the host installer will skip setting the SYSTEM PATH.The change is needed to support new scenarios in the SDK to manage user installs.
Changes
Current Implementation
The host MSI performs major upgrades by installing the new product first (RemoveExistingProducts executes after InstallExecute). The component writing the
DOTNETHOMEto thesharedhostregistry key also modifies the SYSTEM PATH.New Implementation
The PATH variable will be set by separate component. Since the previous upgrade model does not support compositional changes, RemoveExistingProducts now runs after InstallInitialize. This ensures that the old product is removed before the new version is installed. It also supports rollback if a failure occurs (provided that rollbacks have not been turned off). While less efficient, the host MSI only contains a single file so there's no incurred overhead.
WixBroadcastEnvironmentChangecustom action is conditioned and set to execute after InstallFinalize.Testing
Manually tested some scenarios using the bundles.
Null(it won't be installed) andWixBroadcastEnvironmentChangecustom action is skipped.Verified that the existing component IDs did not change
8.0.117:
10 dev build: