Skip to content

Commit 4e5de76

Browse files
author
ChrisMaunder
committed
Small issues with Windows setup
1 parent 78e24c3 commit 4e5de76

File tree

2 files changed

+56
-16
lines changed

2 files changed

+56
-16
lines changed

src/SDK/Scripts/utils.bat

Lines changed: 55 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -529,13 +529,23 @@ shift & goto :%~1
529529

530530
if /i "!requestedType!" == "SDK" (
531531

532+
call :Write "Checking SDKs..."
533+
532534
REM dotnet --version gives the SDK version, not the runtime version.
533535
dotnet --version >NUL 2>NUL
534536
if "%errorlevel%" == "0" (
535537
FOR /F "tokens=* USEBACKQ" %%F IN (`dotnet --version 2^>NUL`) DO ( set currentDotNetVersion=%%F )
538+
539+
call :compareVersions "!currentDotNetVersion!" "!requestedNetMajorVersion!.0.0"
540+
set comparison=!compareResult!
541+
542+
rem echo comparing current !currentDotNetVersion! to request !requestedNetMajorVersion!.0.0
543+
rem echo current_comparison = !comparison!
536544
)
537545
) else (
538546

547+
call :Write "Checking runtimes..."
548+
539549
REM Let's test the runtimes only, since that's all we need
540550
REM example output from 'dotnet --list-runtimes'
541551
REM Microsoft.AspNetCore.App 7.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
@@ -583,10 +593,10 @@ shift & goto :%~1
583593
powershell -NoProfile -ExecutionPolicy unrestricted -File "!sdkScriptsDirPath!\dotnet-install.ps1" --Runtime aspnetcore --Version !requestedNetVersion!
584594
)
585595
if "%DOTNET_ROOT%" == "" (
586-
SET DOTNET_ROOT=%LOCALAPPDATA%\Microsoft\dotnet
587-
SETX DOTNET_ROOT %LOCALAPPDATA%\Microsoft\dotnet
588-
SET PATH=%LOCALAPPDATA%\Microsoft\dotnet;%PATH%
589-
SETX PATH %LOCALAPPDATA%\Microsoft\dotnet;%PATH%
596+
SET "DOTNET_ROOT=%LOCALAPPDATA%\Microsoft\dotnet"
597+
SETX "DOTNET_ROOT" "%LOCALAPPDATA%\Microsoft\dotnet"
598+
SET "PATH=%LOCALAPPDATA%\Microsoft\dotnet;%PATH%"
599+
SETX "PATH" "%LOCALAPPDATA%\Microsoft\dotnet;%PATH%"
590600
)
591601
) else (
592602
if /i "!requestedType!" == "SDK" (
@@ -1243,27 +1253,56 @@ shift & goto :%~1
12431253
)
12441254

12451255
REM The order in which modulesettings files are added is
1246-
REM WE DO NOT SUPPORT DOCKER IN Windows, plus we are ONLY searching non-development files here
1256+
REM WE DO NOT SUPPORT DOCKER IN Windows at the moment
12471257
REM modulesettings.json
1248-
REM (not searched) modulesettings.development.json
1258+
REM modulesettings.development.json
12491259
REM modulesettings.os.json
1250-
REM (not searched) modulesettings.os.development.json
1260+
REM modulesettings.os.development.json
12511261
REM modulesettings.os.architecture.json
1252-
REM (not searched) modulesettings.os.architecture.development.json
1262+
REM modulesettings.os.architecture.development.json
12531263
REM (not supported) modulesettings.docker.json
12541264
REM (not supported) modulesettings.docker.development.json
12551265
REM (not needed yet) modulesettings.device.json (device = raspberrypi, orangepi, jetson)
1256-
REM So we need to check each modulesettings file in reverse order until we find a value for 'key'
1266+
REM
1267+
REM So we need to check each modulesettings file in REVERSE order until we find a value for 'key'
12571268

1258-
call :GetValueFromModuleSettings "!moduleDirPath!\modulesettings.windows.!architecture!.json", "!key!"
1259-
REM echo Check 1: moduleSettingValue = !moduleSettingValue!
1269+
set moduleSettingValue=
1270+
1271+
if "!moduleSettingValue!" == "" (
1272+
call :GetValueFromModuleSettings "!moduleDirPath!\modulesettings.windows.!architecture!.development.json", "!key!"
1273+
if /i "!verbosity!" neq "quiet" if "!moduleSettingValue!" NEQ "" (
1274+
call :WriteLine "Used modulesettings.windows.!architecture!.development.json to get value !moduleSettingValue!" "!color_info!"
1275+
)
1276+
)
1277+
if "!moduleSettingValue!" == "" (
1278+
call :GetValueFromModuleSettings "!moduleDirPath!\modulesettings.windows.!architecture!.json", "!key!"
1279+
if /i "!verbosity!" neq "quiet" if "!moduleSettingValue!" NEQ "" (
1280+
call :WriteLine "Used modulesettings.windows.!architecture!.json to get value !moduleSettingValue!" "!color_info!"
1281+
)
1282+
)
1283+
if "!moduleSettingValue!" == "" (
1284+
call :GetValueFromModuleSettings "!moduleDirPath!\modulesettings.windows.development.json", "!key!"
1285+
if /i "!verbosity!" neq "quiet" if "!moduleSettingValue!" NEQ "" (
1286+
call :WriteLine "Used modulesettings.windows.development.json to get value !moduleSettingValue!" "!color_info!"
1287+
)
1288+
)
12601289
if "!moduleSettingValue!" == "" (
12611290
call :GetValueFromModuleSettings "!moduleDirPath!\modulesettings.windows.json", "!key!"
1262-
REM echo Check 2: moduleSettingValue = !moduleSettingValue!
1291+
if /i "!verbosity!" neq "quiet" if "!moduleSettingValue!" NEQ "" (
1292+
call :WriteLine "Used modulesettings.windows.json to get value !moduleSettingValue!" "!color_info!"
1293+
)
1294+
)
1295+
if "!moduleSettingValue!" == "" (
1296+
call :GetValueFromModuleSettings "!moduleDirPath!\modulesettings.development.json", "!key!"
1297+
if /i "!verbosity!" neq "quiet" if "!moduleSettingValue!" NEQ "" (
1298+
call :WriteLine "Used modulesettings.development.json to get value !moduleSettingValue!" "!color_info!"
1299+
)
12631300
)
12641301
if "!moduleSettingValue!" == "" (
12651302
call :GetValueFromModuleSettings "!moduleDirPath!\modulesettings.json", "!key!"
1266-
REM echo Check 3: moduleSettingValue = !moduleSettingValue!
1303+
if /i "!verbosity!" neq "quiet" if "!moduleSettingValue!" NEQ "" (
1304+
call :WriteLine "Used modulesettings.json to get value !moduleSettingValue!" "!color_info!"
1305+
)
12671306
)
12681307

12691308
if "!debug_json_parse!" == "true" (
@@ -1286,6 +1325,7 @@ REM purely on the name of the propery. THIS METHOD DOES NOT TAKE INTO ACCOUNT TH
12861325
REM DEPTH OF A PROPERTY. If the property is at the root level or 10 levels down,
12871326
REM it's all the same. The extraction is done purely by grep/sed, so is very niaive.
12881327
:GetValueFromModuleSettings jsonFile key returnValue
1328+
set "moduleSettingValue="
12891329
SetLocal EnableDelayedExpansion
12901330

12911331
set jsonFile=%~1
@@ -1359,8 +1399,8 @@ REM it's all the same. The extraction is done purely by grep/sed, so is very nia
13591399
REM directory containing the JSON file so we can skip quotes on !jsonFile!
13601400
pushd "!jsonFile!\.."
13611401

1362-
REM Extract the filename.extn from the json file since it's now in the current dir. This
1363-
REM allows us to place the json file without quotes. ASSUMING jsonFile DOESN'T HAVE SPACES
1402+
REM Extract the filename.ext from the json file since it's now in the current dir. This
1403+
REM allows us to parse the JSON file without quotes. ASSUMING jsonFile DOESN'T HAVE SPACES
13641404
for %%A in ("!jsonFile!") do set "jsonFileCurrentDir=%%~nxA"
13651405

13661406
REM Run the ParseJSON command on jsonFile, and collect ALL lines of output (eg arrays) into

src/SDK/install.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ REM )
4141
REM Utilities ------------------------------------------------------------------
4242

4343
if /i "!useJq!" == "false" (
44-
dotnet build "!sdkPath!\Utilities\ParseJSON" /property:GenerateFullPaths=true /consoleloggerparameters:NoSummary -c Release
44+
dotnet build "!sdkPath!\Utilities\ParseJSON" /property:GenerateFullPaths=true /consoleloggerparameters:NoSummary -c Release >NUL
4545
if exist "!sdkPath!\Utilities\ParseJSON\bin\Release\net7.0\" (
4646
pushd "!sdkPath!\Utilities\ParseJSON\bin\Release\net7.0\"
4747
move * ..\..\..\ > /dev/null

0 commit comments

Comments
 (0)