summaryrefslogtreecommitdiff
path: root/src/test/sandbox/setup_sandbox.bat
blob: fac7ec4c02a09dab81fa53a96eaccaa1cde590a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
@setlocal enabledelayedexpansion
@echo off
SET DOTNET_VERSION=8.0

:MENU
cls
echo [0] Setup EXE install of DotNet for Sandbox
echo [1] Setup ZIP install of DotNet for Sandbox
echo [q] Quit
set /P "Option=Please select install option: "
if "%Option%"=="q" goto END
if "%Option%"=="0" goto EXE
if "%Option%"=="1" goto ZIP

:MENUERROR
cls
echo ERROR: Invalid Option Selected!!
pause
goto MENU

:EXE
echo EXE> dotnet.cfg
if not exist .\assets mkdir .\assets
if %PROCESSOR_ARCHITECTURE%=="ARM64" (
	curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-sdk-win-arm64.exe --output ".\assets\dotnet-sdk-64.exe"
	curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/windowsdesktop-runtime-win-arm64.exe --output ".\assets\windowsdesktop-runtime-64.exe"
) else (
	curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-sdk-win-x64.exe --output ".\assets\dotnet-sdk-64.exe"
	curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/windowsdesktop-runtime-win-x86.exe --output ".\assets\windowsdesktop-runtime-x86.exe"
	curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/windowsdesktop-runtime-win-x64.exe --output ".\assets\windowsdesktop-runtime-64.exe"
)
goto VSDEBUG

:ZIP
echo ZIP> dotnet.cfg
if not exist .\assets mkdir .\assets
if %PROCESSOR_ARCHITECTURE%=="ARM64" (
	curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-sdk-win-arm64.zip --output ".\assets\dotnet-sdk-64.zip"
	curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/windowsdesktop-runtime-win-arm64.zip --output ".\assets\windowsdesktop-runtime-64.zip"
) else (
	curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-sdk-win-x64.zip --output ".\assets\dotnet-sdk-64.zip"
	curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/windowsdesktop-runtime-win-x64.zip --output ".\assets\windowsdesktop-runtime-64.zip"
	curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-runtime-win-x86.zip --output ".\assets\dotnet-runtime-x86.zip"
	curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/windowsdesktop-runtime-win-x86.zip --output ".\assets\windowsdesktop-runtime-x86.zip"
)
goto VSDEBUG

:VSDEBUG
for /f "usebackq tokens=*" %%i in (`"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.VisualStudio.Debugger.Remote -property installationPath`) do (
  set VsInstallDir=%%i
)
if "!VsInstallDir!"=="" (
	for /f "usebackq tokens=*" %%i in (`"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -prerelease -latest -requires Microsoft.VisualStudio.Debugger.Remote -property installationPath`) do (
	  set VsInstallDir=%%i
	)
)
if not "!VsInstallDir!"=="" (
	echo.
	echo Have found VisualStudio Debugger at '%VsInstallDir%'
	set /P "Confirm=Do you wish to copy it for use by the Sandbox? (Y / N):"
	if "!Confirm!"=="Y" goto VSDEBUG_COPY
	if "!Confirm!"=="y" goto VSDEBUG_COPY
	goto END
)
goto END

:VSDEBUG_COPY
if not exist ".\assets\Debugger" (mkdir ".\assets\Debugger")
XCOPY "%VsInstallDir%\Common7\IDE\Remote Debugger\*" ".\assets\Debugger\" /E /Y > nul
echo Debugger files copied


:END
pause
@endlocal