Open JohnMcPMS opened 2 years ago
Related to #2036
Just ran into this issue when installing the Windows SDK via winget:
winget install --source winget --exact --id Microsoft.WindowsSDK.10.0.22621
Found Windows Software Development Kit - Windows 10.0.22621.2428 [Microsoft.WindowsSDK.10.0.22621] Version 10.1.22621.2428
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Downloading
https://download.microsoft.com/download/3/b/d/3bd97f81-3f5b-4922-b86d-dc5145cd6bfe/windowssdk/winsdksetup.exe
██████████████████████████████ 1.32 MB / 1.32 MB
Successfully verified installer hash
Starting package install...
Installer failed with exit code: 2147942487
Installer log is available at: C:\Users\sfudally\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir\WinGet-Microsoft.WindowsSDK.10.0.22621.10.1.22621.2428-2024-01-25-17-06-27.899.log
Log file indicates issue with enabling logs:
[29BC:2174][2024-01-25T17:08:32]i325: Registering dependency: {7645bd51-e95b-48cd-bf4b-0e9ab7ef33b0} on package provider: Microsoft.Windows.SDKDebuggers.x86.10, package: package_SDKDebuggers_x86_en_us
[29BC:2174][2024-01-25T17:08:32]e000: Error 0x80070057: Failed to enable logging for package: package_ApplicationVerifierarm64ExternalPackageDesktopEditions_arm64_en_us to: C:\Users\sfudally\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir\WinGet-Microsoft.WindowsSDK.10.0.22621.10.1.22621.2428-2024-01-25-17-06-27.899_004_package_ApplicationVerifierarm64ExternalPackageDesktopEditions_arm64_en_us.log
[29BC:2174][2024-01-25T17:08:32]e000: Error 0x80070057: Failed to execute MSI package.
[0954:30CC][2024-01-25T17:08:32]e000: Error 0x80070057: Failed to configure per-machine MSI package.
I needed to use the following workaround to get around it (similar to https://github.com/microsoft/winget-cli/issues/2036#issuecomment-1460699802):
winget install --source winget --exact --id Microsoft.WindowsSDK.10.0.22621 --log $env:USERPROFILE/Desktop/sdk-install.log
Description of the new feature / enhancement
Some installers append additional characters to the log file path that we give, and the default log file path already long to begin with. The default path is in a location that makes submitting feedback via Feedback Hub collect them so that we can better diagnose problems, so we don't want to change that.
If the installer makes the path longer without using the proper Windows-isms for long path support, it can fail to install seemingly at random due to the length of the user account string, version, etc.
We should consider creating a symlink in
%TEMP%
that points to our default location and pass that instead.Proposed technical implementation details
Create a symlink in
%TEMP%
that points to the default log location and use that path instead.Current default:
Proposed symlink name (actually the result of
GetTempPathW
):Which will save 61 characters, or about 25% of
MAX_PATH
.