@samitouri / QOSAMI-WSL / commits / b130d5bf

Add a UserConfig setting to use local wsldevicehost binaries instead of nuget (#41241)

Blue committed Aug 4, 2026 at 23:04 UTC b130d5bfed51ae0b5550d2198fd7a5c5f9eb179b
4 files changed +19 -4
CMakeLists.txt
+13 -2
@@ -126,7 +126,6 @@ find_nuget_package(Microsoft.Identity.MSAL.WSL.Proxy MSAL /build/native/bin)
126 find_nuget_package(Microsoft.RemoteDesktop.Client.MSRDC.SessionHost MSRDC /build/native/bin)
127 find_nuget_package(Microsoft.Taef TAEF /)
128 find_nuget_package(Microsoft.Windows.ImplementationLibrary WIL /)
129 -find_nuget_package(Microsoft.WSL.DeviceHost WSL_DEVICE_HOST /build/native)
129 find_nuget_package(Microsoft.WSL.Kernel KERNEL /build/native)
130 find_nuget_package(Microsoft.WSL.bsdtar BSDTARD /build/native/bin)
131 find_nuget_package(Microsoft.WSL.LinuxSdk LINUXSDK /)
@@ -169,6 +168,16 @@ if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/UserConfig.cmake")
168 find_package(USER REQUIRED PATHS ${CMAKE_CURRENT_LIST_DIR})
169 endif()
170
171 +if (WSL_DEVICEHOST_BIN)
172 + set(WSL_VIRTIO_NET_IDL_PATH "${WSL_DEVICEHOST_BIN}/WslDeviceHost.idl")
173 + set(WSL_DEVICE_HOST_DLL_PATH "${WSL_DEVICEHOST_BIN}/wsldevicehost.dll")
174 + set(WSL_DEVICE_HOST_VERSION "9.0.0-localbuild")
175 +else()
176 + find_nuget_package(Microsoft.WSL.DeviceHost WSL_DEVICE_HOST /build/native)
177 + set(WSL_VIRTIO_NET_IDL_PATH "${WSL_DEVICE_HOST_SOURCE_DIR}/idl/WslDeviceHost.idl")
178 + set(WSL_DEVICE_HOST_DLL_PATH "${WSL_DEVICE_HOST_SOURCE_DIR}/bin/${TARGET_PLATFORM}/wsldevicehost.dll")
179 +endif()
180 +
181 # Optional target configuration
182
183 if (NOT DEFINED WSL_BUILD_WSL_SETTINGS)
@@ -241,7 +250,9 @@ file(CREATE_LINK ${WSLDEPS_SOURCE_DIR}/bin/wsldeps.dll ${BIN}/wsldeps.dll)
250 file(CREATE_LINK ${WSLDEPS_SOURCE_DIR}/bin/wsldeps.pdb ${BIN}/wsldeps.pdb)
251 # wsldevicehost.dll is packaged directly from its NuGet package, so only its PDB
252 # needs linking into bin for symbol publishing.
244 -file(CREATE_LINK ${WSL_DEVICE_HOST_SOURCE_DIR}/bin/${TARGET_PLATFORM}/wsldevicehost.pdb ${BIN}/wsldevicehost.pdb)
253 +if (NOT WSL_DEVICEHOST_BIN)
254 + file(CREATE_LINK ${WSL_DEVICE_HOST_SOURCE_DIR}/bin/${TARGET_PLATFORM}/wsldevicehost.pdb ${BIN}/wsldevicehost.pdb)
255 +endif()
256
257 if (${SKIP_PACKAGE_SIGNING})
258 set(PACKAGE_SIGN_COMMAND echo Skipped package signing for:)
UserConfig.cmake.sample
+4
@@ -2,6 +2,10 @@
2
3 message(STATUS "Loading user configuration")
4
5 +# Uncomment to use locally built wsldevicehost binaries.
6 +# This folder should contain both wsldevicehost.dll and WslDeviceHost.idl
7 +# set(WSL_DEVICEHOST_BIN "C:/path/to/devicehost/bin")
8 +
9 # Uncomment to enable development packages (smaller, faster to install)
10 # # Note: .vhd files fail to mount via symlink / hardlink, so COPY is needed.
11 # set(WSL_DEV_BINARY_PATH "C:/wsldev")
msipackage/package.wix.in
+1 -1
@@ -293,7 +293,7 @@
293 which would fail the install. -->
294 <ServiceControl Id="StopService" Stop="both" Remove="uninstall" Name="WSLService" Wait="yes" />
295
296 - <File Id="wsldevicehost.dll" Source="${WSL_DEVICE_HOST_SOURCE_DIR}/bin/${TARGET_PLATFORM}/wsldevicehost.dll" />
296 + <File Id="wsldevicehost.dll" Source="${WSL_DEVICE_HOST_DLL_PATH}" />
297
298 <!-- WSLC COM app - activated through WSLService -->
299 <RegistryKey Root="HKCR" Key="AppID\{E9B79997-57E3-4201-AECC-6A464E530DD2}">
src/windows/wsldevicehoststub/inc/CMakeLists.txt
+1 -1
@@ -1,3 +1,3 @@
1 -add_idl(wsldevicehostidl "${WSL_DEVICE_HOST_SOURCE_DIR}/idl/WslDeviceHost.idl" "")
1 +add_idl(wsldevicehostidl "${WSL_VIRTIO_NET_IDL_PATH}" "")
2
3 set_target_properties(wsldevicehostidl PROPERTIES FOLDER windows)