Skip to content

Commit 7c0b95d

Browse files
committed
chore: 调整依赖安装
1 parent 817aa83 commit 7c0b95d

1 file changed

Lines changed: 37 additions & 10 deletions

File tree

MFAAvalonia/DependencySetup_依赖库安装_win.bat

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,33 @@ set "BOLD=%ESC%[1m"
1616
:: 初始化错误标志
1717
set "ErrorOccurred=0"
1818

19+
:: 检测系统架构
20+
set "ARCH=%PROCESSOR_ARCHITECTURE%"
21+
if /i "%ARCH%"=="AMD64" (
22+
set "ARCH_NAME=x64"
23+
set "VC_PACKAGE=Microsoft.VCRedist.2015+.x64"
24+
set "VC_DOWNLOAD=https://aka.ms/vs/17/release/vc_redist.x64.exe"
25+
set "DOTNET_DOWNLOAD=https://aka.ms/dotnet/10.0/windowsdesktop-runtime-win-x64.exe"
26+
) else if /i "%ARCH%"=="x86" (
27+
set "ARCH_NAME=x86"
28+
set "VC_PACKAGE=Microsoft.VCRedist.2015+.x86"
29+
set "VC_DOWNLOAD=https://aka.ms/vs/17/release/vc_redist.x86.exe"
30+
set "DOTNET_DOWNLOAD=https://aka.ms/dotnet/10.0/windowsdesktop-runtime-win-x86.exe"
31+
) else if /i "%ARCH%"=="ARM64" (
32+
set "ARCH_NAME=ARM64"
33+
set "VC_PACKAGE=Microsoft.VCRedist.2015+.arm64"
34+
set "VC_DOWNLOAD=https://aka.ms/vs/17/release/vc_redist.arm64.exe"
35+
set "DOTNET_DOWNLOAD=https://aka.ms/dotnet/10.0/windowsdesktop-runtime-win-arm64.exe"
36+
) else (
37+
echo %RED%不支持的系统架构: %ARCH%%RESET%
38+
echo %RED%Unsupported system architecture: %ARCH%%RESET%
39+
pause
40+
exit /b 1
41+
)
42+
43+
echo %CYAN%检测到系统架构 / Detected system architecture: %BOLD%%ARCH_NAME%%RESET%
44+
echo.
45+
1946
openfiles >nul 2>&1
2047
if %errorlevel% neq 0 (
2148
echo %YELLOW%正在获取管理员权限...%RESET%
@@ -24,27 +51,27 @@ if %errorlevel% neq 0 (
2451
exit /b
2552
)
2653

54+
echo.
2755
echo.
2856
echo %BLUE%====================================================================================================%RESET%
29-
echo %BOLD%%CYAN%正在安装 Microsoft Visual C++ Redistributable%RESET%
30-
echo %BOLD%%CYAN%Installing Microsoft Visual C++ Redistributable%RESET%
57+
echo %BOLD%%CYAN%正在安装 Microsoft Visual C++ Redistributable (%ARCH_NAME%)%RESET%
58+
echo %BOLD%%CYAN%Installing Microsoft Visual C++ Redistributable (%ARCH_NAME%)%RESET%
3159
echo.
32-
3360
echo %YELLOW%如果是第一次使用 winget,可能会提示接受协议,请输入 Y 并按回车继续%RESET%
3461
echo %YELLOW%If this is your first time using winget, you may be prompted to accept the terms. %RESET%
3562
echo %YELLOW%Please enter Y and press Enter to continue.%RESET%
3663
echo.
3764

38-
winget install "Microsoft.VCRedist.2015+.x64" --override "/repair /passive /norestart" --uninstall-previous --accept-package-agreements --force
65+
winget install "%VC_PACKAGE%" --override "/repair /passive /norestart" --uninstall-previous --accept-package-agreements --force
3966
if %errorlevel% neq 0 (
4067
set "ErrorOccurred=1"
4168
)
4269
echo %BLUE%====================================================================================================%RESET%
4370

4471
echo.
4572
echo %BLUE%====================================================================================================%RESET%
46-
echo %BOLD%%CYAN%正在安装 .NET Desktop Runtime 10.0%RESET%
47-
echo %BOLD%%CYAN%Installing .NET Desktop Runtime 10.0%RESET%
73+
echo %BOLD%%CYAN%正在安装 .NET Desktop Runtime 10.0 (%ARCH_NAME%)%RESET%
74+
echo %BOLD%%CYAN%Installing .NET Desktop Runtime 10.0 (%ARCH_NAME%)%RESET%
4875
echo.
4976

5077
winget install "Microsoft.DotNet.DesktopRuntime.10" --override "/repair /passive /norestart" --uninstall-previous --accept-package-agreements --force
@@ -69,11 +96,11 @@ if %ErrorOccurred% equ 0 (
6996
echo %YELLOW%You can manually copy the following two links into your browser to download and install the required components.%RESET%
7097
echo %YELLOW%If the installation is successful, you don't need to run this dependency installation script again.%RESET%
7198
echo.
72-
echo %WHITE%Microsoft Visual C++ Redistributable:%RESET%
73-
echo %CYAN%https://aka.ms/vs/17/release/vc_redist.x64.exe%RESET%
99+
echo %WHITE%Microsoft Visual C++ Redistributable (%ARCH_NAME%):%RESET%
100+
echo %CYAN%%VC_DOWNLOAD%%RESET%
74101
echo.
75-
echo %WHITE%.NET Desktop Runtime 10.0:%RESET%
76-
echo %CYAN%https://aka.ms/dotnet/10.0/windowsdesktop-runtime-win-x64.exe%RESET%
102+
echo %WHITE%.NET Desktop Runtime 10.0 (%ARCH_NAME%):%RESET%
103+
echo %CYAN%%DOTNET_DOWNLOAD%%RESET%
77104
echo %RED%====================================================================================================%RESET%
78105
)
79106

0 commit comments

Comments
 (0)