-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCheckDotNetVersion.bat
More file actions
42 lines (34 loc) · 1.15 KB
/
CheckDotNetVersion.bat
File metadata and controls
42 lines (34 loc) · 1.15 KB
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
@echo off
setlocal enabledelayedexpansion
rem Define the required .NET version
set requiredVersion=5
rem Get the installed .NET version
for /f "delims=" %%v in ('dotnet --version') do (
set version=%%v
)
for /f "tokens=1 delims=." %%a in ("!version!") do (
set version=%%a
)
rem Define the full path to ProcessExplorer.runtimeconfig.json
set "filePath=ProcessExplorer.runtimeconfig.json"
rem Check if the installed version is greater than or equal to the required version
if "%version%" GEQ "%requiredVersion%" (
echo Found .NET version %version% required: %requiredVersion% or greater
rem Update ProcessExplorer.runtimeconfig.json to use .NET %version%
(
echo {
echo "runtimeOptions": {
echo "tfm": "net%version%.0",
echo "framework": {
echo "name": "Microsoft.WindowsDesktop.App",
echo "version": "%version%.0.0"
echo }
echo }
echo }
) > "%filePath%"
echo Updated ProcessExplorer.runtimeconfig.json to use .NET %version%
exit /b 0
) else (
echo Required .NET version %requiredVersion% or greater is not installed.
exit /b 1
)