Skip to content

Commit 891bbdc

Browse files
committed
Updates to Windows setup script for winget install
1 parent 00331db commit 891bbdc

File tree

1 file changed

+40
-20
lines changed

1 file changed

+40
-20
lines changed

src/scripts/utils.bat

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -644,33 +644,53 @@ shift & goto :%~1
644644
if errorlevel 1 (
645645
call :Write "Installing WinGet..." %color_info%
646646

647-
set "archType=x64"
648-
if /i "!architecture!" == "arm64" set "archType=arm64"
649-
650-
REM https://learn.microsoft.com/en-us/windows/package-manager/winget/#install-winget-on-windows-sandbox
651-
powershell -command ^
652-
$progressPreference = 'silentlyContinue'; ^
653-
Invoke-WebRequest -Uri https://aka.ms/getwinget -OutFile Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle; ^
654-
Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.!archType!.14.00.Desktop.appx -OutFile Microsoft.VCLibs.!archType!.14.00.Desktop.appx; ^
655-
Invoke-WebRequest -Uri https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.!archType!.appx -OutFile Microsoft.UI.Xaml.2.8.!archType!.appx; ^
656-
Add-AppxPackage Microsoft.VCLibs.!archType!.14.00.Desktop.appx; ^
657-
Add-AppxPackage Microsoft.UI.Xaml.2.8.!archType!.appx; ^
658-
Add-AppxPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle;
659-
660-
call :WriteLine "Done." %color_info%
661-
662-
call :Write "Cleaning up..." %color_info%
663-
del Microsoft.VCLibs.!archType!.14.00.Desktop.appx
664-
del Microsoft.UI.Xaml.2.8.!archType!.appx
665-
del Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
666-
call :WriteLine "Done." %color_info%
647+
set DoWingetInstall=true
648+
if "!DoWingetInstall!" == "true" (
649+
set "archType=x64"
650+
if /i "!architecture!" == "arm64" set "archType=arm64"
651+
652+
REM https://learn.microsoft.com/en-us/windows/package-manager/winget/#install-winget-on-windows-sandbox
653+
if /i "%verbosity%" == "quiet" (
654+
set progressType=silentlyContinue
655+
) else (
656+
set progressType=Continue
657+
)
658+
powershell -command $progressPreference = '!progressType!'; ^
659+
Invoke-WebRequest -Uri https://aka.ms/getwinget -OutFile Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle; ^
660+
Add-AppxPackage Microsoft.VCLibs.!archType!.14.00.Desktop.appx;
661+
662+
powershell -command $progressPreference = '!progressType!'; ^
663+
Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.!archType!.14.00.Desktop.appx -OutFile Microsoft.VCLibs.!archType!.14.00.Desktop.appx; ^
664+
Add-AppxPackage Microsoft.UI.Xaml.2.8.!archType!.appx;
665+
666+
powershell -command $progressPreference = '!progressType!'; ^
667+
Invoke-WebRequest -Uri https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.!archType!.appx -OutFile Microsoft.UI.Xaml.2.8.!archType!.appx; ^
668+
Add-AppxPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle;
669+
670+
call :WriteLine "Done." %color_info%
671+
672+
call :Write "Cleaning up..." %color_info%
673+
del Microsoft.VCLibs.140.00.UWPDesktop.appx
674+
del Microsoft.VCLibs.!archType!.14.00.Desktop.appx
675+
del Microsoft.UI.Xaml.2.8.!archType!.appx
676+
del Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
677+
call :WriteLine "Done." %color_info%
678+
) else (
679+
powershell -command "Add-AppxPackage -RegisterByFamilyName -MainPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe"
680+
)
667681
)
668682

669683
if /i "!requestedType!" == "SDK" (
670684
winget install Microsoft.DotNet.SDK.!requestedNetMajorVersion!
671685
) else (
672686
winget install Microsoft.DotNet.AspNetCore.!requestedNetMajorVersion!
673687
)
688+
689+
call :WriteLine ""
690+
call :WriteLine "** You may need to restart this terminal (or VS Code if you're " %color_error%
691+
call :WriteLine " in VS Code) and rerun setup.bat for the rest of this setup " %color_error%
692+
call :WriteLine " script to work." %color_error%
693+
call :WriteLine ""
674694
)
675695
)
676696
)

0 commit comments

Comments
 (0)