@joebigelow / wix-1 / commits / 83d92ef8

Added host menu options for EXE / ZIP installation Removed ARM64/AMD64 folders for dotnet, the Sandbox MUST match the host here, so no point downloading the installer for the non-host platform.

Added host menu options for EXE / ZIP installation Removed ARM64/AMD64 folders for dotnet, the Sandbox MUST match the host here, so no point downloading the installer for the non-host platform. Debugger could probably be reduced in the same manner, but have not in this iteration. Have also added a simple README, just to explain (very basic) operation. Signed-off-by: Bevan Weiss <bevan.weiss@gmail.com>

Bevan Weiss committed Jun 26, 2024 at 18:41 UTC 83d92ef88270a740bc96609f8d967986e4f91e99
3 files changed +88 -40
src/test/sandbox/README new
+2
@@ -0,0 +1,2 @@
1 +1. Run setup_sandbox.bat from the Host, pick whether you want to use the EXE or the ZIP to install Dotnet. The chosen option will be automatically downloaded.
2 +2. Once you have built Wix Toolset and wish to perform integration testing, you can just launch the Sandbox by double-clicking (or executing) TestSandbox.wsb
\ No newline at end of file
src/test/sandbox/setup_sandbox.bat
+43 -16
@@ -2,20 +2,41 @@
2 @echo off
3 SET DOTNET_VERSION=8.0
4
5 -if not exist AMD64 (mkdir AMD64)
6 -if not exist ARM64 (mkdir ARM64)
7 -REM if not exist VSTest (mkdir VSTest)
8 -
9 -@echo on
10 -REM curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-runtime-win-x64.zip --output ".\AMD64\dotnet-runtime.zip"
11 -curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-sdk-win-x64.zip --output ".\AMD64\dotnet-sdk.zip"
12 -REM curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-runtime-win-arm64.zip --output ".\ARM64\dotnet-runtime.zip"
13 -curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-sdk-win-arm64.zip --output ".\ARM64\dotnet-sdk.zip"
14 -@echo off
5 +:MENU
6 +cls
7 +echo [0] Setup EXE install of DotNet for Sandbox
8 +echo [1] Setup ZIP install of DotNet for Sandbox
9 +echo [q] Quit
10 +set /P "Option=Please select install option: "
11 +if "%Option%"=="q" goto END
12 +if "%Option%"=="0" goto EXE
13 +if "%Option%"=="1" goto ZIP
14 +
15 +:MENUERROR
16 +cls
17 +echo ERROR: Invalid Option Selected!!
18 +pause
19 +goto MENU
20 +
21 +:EXE
22 +echo EXE> dotnet.cfg
23 +if %PROCESSOR_ARCHITECTURE%=="ARM64" (
24 + curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-sdk-win-arm64.exe --output ".\dotnet-sdk.exe"
25 +) else (
26 + curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-sdk-win-x64.exe --output ".\dotnet-sdk.exe"
27 +)
28 +goto VSDEBUG
29
16 -REM curl -L0 https://aka.ms/vs/17/release/RemoteTools.amd64ret.enu.exe --output ".\AMD64\RemoteTools.exe"
17 -REM curl -L0 https://aka.ms/vs/17/release/RemoteTools.arm64ret.enu.exe --output ".\ARM64\RemoteTools.exe"
30 +:ZIP
31 +echo ZIP> dotnet.cfg
32 +if %PROCESSOR_ARCHITECTURE%=="ARM64" (
33 + curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-sdk-win-arm64.zip --output ".\dotnet-sdk.zip"
34 +) else (
35 + curl -L0 https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-sdk-win-x64.zip --output ".\dotnet-sdk.zip"
36 +)
37 +goto VSDEBUG
38
39 +:VSDEBUG
40 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 (
41 set VsInstallDir=%%i
42 )
@@ -28,12 +49,18 @@ if not "!VsInstallDir!"=="" (
49 echo.
50 echo Have found VisualStudio Debugger at '%VsInstallDir%'
51 set /P "Confirm=Do you wish to copy it for use by the Sandbox? (Y / N):"
31 - echo Confirm = %Confirm%
32 - @if "%Confirm%"=="Y" or "%Confirm%"="y" (
33 - XCOPY "%VsInstallDir%\Common7\IDE\Remote Debugger\*" ".\Debugger\" /E /Y
34 - )
52 + if "%Confirm%"=="Y" goto VSDEBUG_COPY
53 + if "%Confirm%"=="y" goto VSDEBUG_COPY
54 + goto END
55 )
56 +goto END
57 +
58 +:VSDEBUG_COPY
59 +if not exist Debugger (mkdir Debugger)
60 +XCOPY "%VsInstallDir%\Common7\IDE\Remote Debugger\*" ".\Debugger\" /E /Y > nul
61 +echo Debugger files copied
62
63
64 +:END
65 pause
66 @endlocal
src/test/sandbox/startup.bat
+43 -24
@@ -1,28 +1,19 @@
1 @setlocal
2 +@echo off
3 SET DOTNET_VERSION=8.0
4 SET SANDBOX_FILES=C:\sandbox
5
6 +set /p InstallMethod=<%SANDBOX_FILES%\dotnet.cfg
7 +
8 pushd "%TEMP%"
9 +if "%InstallMethod%"=="EXE" goto EXE
10 +if "%InstallMethod%"=="ZIP" goto ZIP
11 +goto ERROR_NO_CONFIG
12
13 +:ZIP
14 mkdir "%ProgramFiles%\dotnet"
8 -REM @if exist %SANDBOX_FILES%\%PROCESSOR_ARCHITECTURE%\dotnet-runtime.zip (
9 -REM tar -oxzf "%SANDBOX_FILES%\%PROCESSOR_ARCHITECTURE%\dotnet-runtime.zip" -C "%ProgramFiles%\dotnet"
10 -REM ) else (
11 -REM if %PROCESSOR_ARCHITECTURE%=="ARM64" (
12 -REM curl -L https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-runtime-win-arm64.zip --output dotnet-runtime.zip
13 -REM ) else (
14 -REM curl -L https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-runtime-win-x64.zip --output dotnet-runtime.zip
15 -REM )
16 -REM if %errorlevel% NEQ 0 (
17 -REM echo No pre-provided dotnet runtime, and failed to download. Confirm networking is available.
18 -REM goto :ERROR
19 -REM )
20 -REM tar -oxzf dotnet-runtime.zip -C "%ProgramFiles%\dotnet"
21 -REM del dotnet-runtime.zip
22 -REM )
23 -
24 -@if exist %SANDBOX_FILES%\%PROCESSOR_ARCHITECTURE%\dotnet-sdk.zip (
25 - tar -oxzf "%SANDBOX_FILES%\%PROCESSOR_ARCHITECTURE%\dotnet-sdk.zip" -C "%ProgramFiles%\dotnet"
15 +if exist %SANDBOX_FILES%\dotnet-sdk.zip (
16 + tar -oxzf "%SANDBOX_FILES%\dotnet-sdk.zip" -C "%ProgramFiles%\dotnet"
17 ) else (
18 if %PROCESSOR_ARCHITECTURE%=="ARM64" (
19 curl -L https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-sdk-win-arm64.zip --output dotnet-sdk.zip
@@ -31,21 +22,49 @@ REM )
22 )
23 if %errorlevel% NEQ 0 (
24 echo "No pre-provided dotnet sdk, and failed to download. Confirm networking is available."
34 - goto ERROR
25 + goto ERROR_NO_DOTNET
26 )
27 tar -oxzf dotnet-sdk.zip -C "%ProgramFiles%\dotnet"
28 del dotnet-sdk.zip
29 )
30 +goto PROCEED
31
40 -@endlocal
32 +:EXE
33 +if exist %SANDBOX_FILES%\dotnet-sdk.exe (
34 + "%SANDBOX_FILES%\dotnet-sdk.exe" /install /quiet /norestart
35 +) else (
36 + if %PROCESSOR_ARCHITECTURE%=="ARM64" (
37 + curl -L https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-sdk-win-arm64.exe --output dotnet-sdk.exe
38 + ) else (
39 + curl -L https://aka.ms/dotnet/%DOTNET_VERSION%/dotnet-sdk-win-x64.exe --output dotnet-sdk.exe
40 + )
41 + if %errorlevel% NEQ 0 (
42 + echo "No pre-provided dotnet sdk, and failed to download. Confirm networking is available."
43 + goto ERROR_NO_DOTNET
44 + )
45 + dotnet-sdk.exe /install /quiet /norestart
46 +)
47 +goto PROCEED
48 +
49 +:PROCEED
50 +endlocal
51 SETX PATH "%PATH%;%ProgramFiles%\dotnet" /M
52 SET PATH=%PATH%;%ProgramFiles%\dotnet
53 +
54 dotnet nuget locals all --clear
55 dotnet help
56
57 +popd
58 +cd c:\build
59 +start "Menu" cmd /c C:\sandbox\runtest_menu.bat
60 +goto END
61
47 -:ERROR
62 +:ERROR_NO_CONFIG
63 +start "ERROR" CMD /c echo ERROR: Host configuration has not been run, run setup_sandbox.bat first ^& pause
64 +goto END
65
49 -@popd
50 -cd c:\build
51 -start cmd /c C:\sandbox\runtest_menu.bat
66 +
67 +:ERROR_NO_DOTNET
68 +start "ERROR" CMD /c echo ERROR: Failed to find dotnet install, and download failed. Run setup_sandbox.bat again ^& pause
69 +
70 +:END