Install NOTICE.txt to the install directory via MSI (#40893)

beena352 committed Jun 24, 2026 at 20:12 UTC 671da3fa97d58d8fbe55647800b2b80f582240c3
4 files changed +36 -7
.pipelines/wsl-build-notice.yml
+27
@@ -16,11 +16,38 @@ steps:
16 - task: ComponentGovernanceComponentDetection@0
17 displayName: Component Detection
18
19 +# Append the WSLg NuGet's NOTICE: it covers Linux OSS shipped as binaries, which
20 +# Component Governance doesn't detect.
21 +- task: NuGetToolInstaller@1
22 + displayName: Install NuGet
23 +
24 +- task: NuGetCommand@2
25 + displayName: Restore packages (for the WSLg NOTICE)
26 + inputs:
27 + command: restore
28 + restoreSolution: packages.config
29 + feedsToUse: config
30 + nugetConfigPath: NuGet.Config
31 + restoreDirectory: $(Build.SourcesDirectory)/packages
32 +
33 +- powershell: |
34 + $version = ([xml](Get-Content packages.config)).packages.package |
35 + Where-Object { $_.id -eq 'Microsoft.WSLg' } |
36 + Select-Object -ExpandProperty version
37 + $notice = "$(Build.SourcesDirectory)/packages/Microsoft.WSLg.$version/NOTICE.txt"
38 + if (-not (Test-Path $notice)) {
39 + Write-Error "WSLg NOTICE not found at $notice"
40 + exit 1
41 + }
42 + Write-Host "##vso[task.setvariable variable=WslgNoticePath]$notice"
43 + displayName: Resolve WSLg NOTICE path
44 +
45 - task: notice@0
46 displayName: Generate NOTICE file
47 inputs:
48 outputfile: $(System.DefaultWorkingDirectory)/NOTICE.txt
49 outputformat: text
50 + additionaldata: $(WslgNoticePath)
51
52 - task: PipAuthenticate@1
53 inputs:
CMakeLists.txt
+3 -3
@@ -132,7 +132,7 @@ find_nuget_package(Microsoft.WSL.bsdtar BSDTARD /build/native/bin)
132 find_nuget_package(Microsoft.WSL.LinuxSdk LINUXSDK /)
133 find_nuget_package(Microsoft.WSL.TestDistro TEST_DISTRO /)
134 find_nuget_package(Microsoft.WSL.TestData WSL_TEST_DATA /)
135 -find_nuget_package(Microsoft.WSLg WSLG /build/native/bin)
135 +find_nuget_package(Microsoft.WSLg WSLG /)
136 find_nuget_package(vswhere VSWHERE /tools)
137 find_nuget_package(Wix WIX /tools/net6.0/any)
138
@@ -235,8 +235,8 @@ set(PACKAGE_CERTIFICATE ${GENERATED_DIR}/dev-cert.pfx)
235 # and the pipeline's symbol publishing step find them. Without the PDBs here,
236 # Watson can't resolve function names in their crash frames.
237 string(REPLACE ".dll" ".pdb" WSLG_TS_PLUGIN_PDB ${WSLG_TS_PLUGIN_DLL})
238 -file(CREATE_LINK ${WSLG_SOURCE_DIR}/${TARGET_PLATFORM}/${WSLG_TS_PLUGIN_DLL} ${BIN}/${WSLG_TS_PLUGIN_DLL})
239 -file(CREATE_LINK ${WSLG_SOURCE_DIR}/${TARGET_PLATFORM}/${WSLG_TS_PLUGIN_PDB} ${BIN}/${WSLG_TS_PLUGIN_PDB})
238 +file(CREATE_LINK ${WSLG_SOURCE_DIR}/build/native/bin/${TARGET_PLATFORM}/${WSLG_TS_PLUGIN_DLL} ${BIN}/${WSLG_TS_PLUGIN_DLL})
239 +file(CREATE_LINK ${WSLG_SOURCE_DIR}/build/native/bin/${TARGET_PLATFORM}/${WSLG_TS_PLUGIN_PDB} ${BIN}/${WSLG_TS_PLUGIN_PDB})
240 file(CREATE_LINK ${WSLDEPS_SOURCE_DIR}/bin/wsldeps.dll ${BIN}/wsldeps.dll)
241 file(CREATE_LINK ${WSLDEPS_SOURCE_DIR}/bin/wsldeps.pdb ${BIN}/wsldeps.pdb)
242 # wsldevicehost.dll is packaged directly from its NuGet package, so only its PDB
msipackage/CMakeLists.txt
+1 -1
@@ -52,7 +52,7 @@ add_custom_command(
52 COMMAND ${WIX_SOURCE_DIR}/wix.exe build ${PACKAGE_WIX} -o ${OUTPUT_PACKAGE} -arch ${TARGET_PLATFORM} -dcl ${COMPRESSION} -cc ${CAB_CACHE} -pdbtype none
53 COMMAND ${CMAKE_COMMAND} -E touch "${CMAKE_CURRENT_BINARY_DIR}/CmakeFiles/msipackage"
54 VERBATIM
55 - DEPENDS ${PACKAGE_WIX} ${BINARIES_DEPENDENCIES} # Make sure the package is rebuilt if any of the binaries or resources change
55 + DEPENDS ${PACKAGE_WIX} ${BINARIES_DEPENDENCIES} ${CMAKE_SOURCE_DIR}/NOTICE.txt # Make sure the package is rebuilt if any of the binaries or resources change
56 )
57
58 add_custom_target(msipackage DEPENDS ${OUTPUT_PACKAGE})
msipackage/package.wix.in
+5 -3
@@ -34,12 +34,14 @@
34 <File Id="wslserviceproxystub.dll" Name="wslserviceproxystub.dll" Source="${PACKAGE_INPUT_DIR}/wslserviceproxystub.dll" />
35 <File Id="wsldeps.dll" Name="wsldeps.dll" Source="${PACKAGE_INPUT_DIR}/wsldeps.dll" />
36
37 + <File Id="NOTICE.txt" Name="NOTICE.txt" Source="${CMAKE_SOURCE_DIR}/NOTICE.txt" />
38 +
39 <?if "${WSL_BUILD_WSL_SETTINGS}" = "true" ?>
40 <File Id="libwsl.dll" Name="libwsl.dll" Source="${PACKAGE_INPUT_DIR}/libwsl.dll" />
41 <?endif?>
42
43 <?if "${WSL_DEV_BINARY_PATH}" = "" ?>
42 - <File Id="system.vhd" Source="${WSLG_SOURCE_DIR}/${TARGET_PLATFORM}/system.vhd"/>
44 + <File Id="system.vhd" Source="${WSLG_SOURCE_DIR}/build/native/bin/${TARGET_PLATFORM}/system.vhd"/>
45 <?endif?>
46
47 <!-- Add INSTALLDIR to system PATH to make wslc.exe and other CLI tools accessible. -->
@@ -439,8 +441,8 @@
441 <Component Id="wslg" Guid="F0C8D6BA-1502-41E7-BF72-D93DFA134731" UninstallWhenSuperseded="yes" DisableRegistryReflection="yes" Bitness="always64">
442 <?if "${WSL_DEV_BINARY_PATH}" = "" ?>
443 <File Id="msrdc.exe" Source="${MSRDC_SOURCE_DIR}/${TARGET_PLATFORM}/msrdc.exe" />
442 - <File Id="wslg.rdp" Source="${WSLG_SOURCE_DIR}/wslg.rdp" />
443 - <File Id="wslg_desktop.rdp" Source="${WSLG_SOURCE_DIR}/wslg_desktop.rdp" />
444 + <File Id="wslg.rdp" Source="${WSLG_SOURCE_DIR}/build/native/bin/wslg.rdp" />
445 + <File Id="wslg_desktop.rdp" Source="${WSLG_SOURCE_DIR}/build/native/bin/wslg_desktop.rdp" />
446 <File Id="rdclientax.dll" Source="${MSRDC_SOURCE_DIR}/${TARGET_PLATFORM}/rdclientax.dll" />
447 <File Id="rdpnanoTransport.dll" Source="${MSRDC_SOURCE_DIR}/${TARGET_PLATFORM}/rdpnanoTransport.dll" />
448 <File Id="RdpWinStlHelper.dll" Source="${MSRDC_SOURCE_DIR}/${TARGET_PLATFORM}/RdpWinStlHelper.dll" />