devicehost: stop re-signing and fix MSI installer failing to replace wsldevicehost.dll#40075
Open
devicehost: stop re-signing and fix MSI installer failing to replace wsldevicehost.dll#40075
Conversation
wsldevicehost.dll
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the WSL MSI packaging/install flow for wsldevicehost.dll by (1) consuming the already-signed DeviceHost binary directly (avoiding redundant re-signing) and (2) adding a new MSI custom action to terminate any processes locking wsldevicehost.dll so upgrades can overwrite it without requiring a reboot.
Changes:
- Add a
StopDeviceHostSurrogatecustom action (using Restart Manager) and wire it into the MSI execute sequence beforeInstallFiles. - Update MSI packaging to source
wsldevicehost.dlldirectly from the DeviceHost package output path rather than from the generic package input staging. - Update build/pipeline wiring to stop staging/publishing
wsldevicehost.dllas a separately re-signed artifact, and bump the DeviceHost NuGet to1.2.10-0.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/windows/wslinstall/wslinstall.def | Exports the new StopDeviceHostSurrogate entry point from wslinstall.dll. |
| src/windows/wslinstall/DllMain.cpp | Implements StopDeviceHostSurrogate using Restart Manager to shut down processes locking wsldevicehost.dll. |
| src/windows/wslinstall/CMakeLists.txt | Links wslinstall against rstrtmgr.lib for Restart Manager APIs. |
| packages.config | Updates Microsoft.WSL.DeviceHost dependency to 1.2.10-0. |
| msipackage/package.wix.in | Moves wsldevicehost.dll file source to DeviceHost output and adds/schedules the new custom action before InstallFiles. |
| CMakeLists.txt | Removes creation of a build-stage link for wsldevicehost.dll into the staging bin directory (supports “stop re-signing”). |
| .pipelines/build-stage.yml | Removes wsldevicehost.dll from the published artifact pattern list for the main build target set. |
ptrivedi
reviewed
Apr 2, 2026
* Release COM DLLs before installer test MSI operations Add PrepareForMsiOperation() that calls CoFreeUnusedLibrariesEx(0) before each msiexec invocation. This releases in-process COM DLLs like wslserviceproxystub.dll loaded by prior test classes, preventing the Restart Manager from detecting the test process as holding file locks and failing the install on older Server SKUs like ni_release. * fix CoFreeUnusedLibrariesEx --------- Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change accomplishes two things: