-
Notifications
You must be signed in to change notification settings - Fork 73
Expand file tree
/
Copy pathBuildInstaller.bat
More file actions
75 lines (57 loc) · 2.02 KB
/
BuildInstaller.bat
File metadata and controls
75 lines (57 loc) · 2.02 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
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
@ECHO OFF
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
ECHO:
ECHO === Starting Installer Build Workaround ===
REM Store current directory
SET "current_path=%CD%"
REM Try all known editions of Visual Studio 2022
SET "vs_base_path=%ProgramFiles%\Microsoft Visual Studio\2022"
FOR %%E IN (Community Professional Enterprise) DO (
IF EXIST "%vs_base_path%\%%E\Common7\IDE\CommonExtensions\Microsoft\VSI\DisableOutOfProcBuild\DisableOutOfProcBuild.exe" (
SET "buildfix_path=%vs_base_path%\%%E\Common7\IDE\CommonExtensions\Microsoft\VSI\DisableOutOfProcBuild"
SET "devenv_path=%vs_base_path%\%%E\Common7\IDE\devenv.exe"
SET "vs_edition=%%E"
GOTO :FoundEdition
)
)
ECHO [ERROR] Could not find DisableOutOfProcBuild.exe in any known VS2022 edition.
EXIT /B 1
:FoundEdition
ECHO Found Visual Studio 2022 Edition: %vs_edition%
CD /D "%buildfix_path%"
CALL DisableOutOfProcBuild.exe
REM Restore previous directory
CD /D "%current_path%"
REM === Validate required files ===
ECHO:
ECHO === Checking required files ===
SET "error=0"
IF NOT EXIST "UnityLauncherPro\bin\Release\UnityLauncherPro.exe" (
ECHO [ERROR] Missing file: UnityLauncherPro\bin\Release\UnityLauncherPro.exe
SET "error=1"
)
IF NOT EXIST "UnityLauncherPro\Images\icon.ico" (
ECHO [ERROR] Missing file: UnityLauncherPro\Images\icon.ico
SET "error=1"
)
IF %error% NEQ 0 (
ECHO [ERROR] Required files are missing. Aborting installer build.
EXIT /B 1
)
ECHO:
ECHO === Building Installer ===
"%devenv_path%" UnityLauncherPro.sln /Rebuild Release /Project UnityLauncherProInstaller > build_output.log 2>&1
SET "exitCode=%ERRORLEVEL%"
TYPE build_output.log
ECHO:
ECHO === devenv.exe exit code: %exitCode% ===
IF NOT "%exitCode%"=="0" (
ECHO [ERROR] Installer build failed. Check build_output.log for details.
EXIT /B %exitCode%
)
ECHO:
ECHO === Build Complete ===
REM Optional cleanup: disable workaround
REG DELETE "HKCU\Software\Microsoft\VisualStudio\Setup" /v VSDisableOutOfProcBuild /f >NUL 2>&1
ENDLOCAL
EXIT /B %exitCode%