Winget Sources fix (#1773)

- Sometimes, if Winget is installed under user-scope, the source isn't properly installed so that the Admin user can properly use Winget.
- This change installs the sources directly from the Winget CDN.
- Fixes #1771
https://github.com/microsoft/winget-cli/discussions/3258#discussioncomment-5951658
This commit is contained in:
Rux
2024-03-31 10:03:48 -07:00
committed by GitHub
parent 4a7c8a35bf
commit 45ec574221

View File

@ -40,6 +40,8 @@ function Install-WinUtilWinget {
Get-WinUtilWingetLatest Get-WinUtilWingetLatest
Write-Host "Installing Winget w/ Prerequsites`r" Write-Host "Installing Winget w/ Prerequsites`r"
Add-AppxProvisionedPackage -Online -PackagePath $ENV:TEMP\Microsoft.DesktopAppInstaller.msixbundle -DependencyPackagePath $ENV:TEMP\Microsoft.VCLibs.x64.Desktop.appx, $ENV:TEMP\Microsoft.UI.Xaml.x64.appx -LicensePath $ENV:TEMP\License1.xml Add-AppxProvisionedPackage -Online -PackagePath $ENV:TEMP\Microsoft.DesktopAppInstaller.msixbundle -DependencyPackagePath $ENV:TEMP\Microsoft.VCLibs.x64.Desktop.appx, $ENV:TEMP\Microsoft.UI.Xaml.x64.appx -LicensePath $ENV:TEMP\License1.xml
Write-Host "Manually adding Winget Sources, from Winget CDN."
Add-AppxPackage -Path https://cdn.winget.microsoft.com/cache/source.msix #Seems some installs of Winget don't add the repo source, this should makes sure that it's installed every time.
Write-Host "Winget Installed" -ForegroundColor Green Write-Host "Winget Installed" -ForegroundColor Green
# Winget only needs a refresh of the environment variables to be used. # Winget only needs a refresh of the environment variables to be used.
Write-Output "Refreshing Environment Variables...`n" Write-Output "Refreshing Environment Variables...`n"