@echo off rem No commandline parameter will build the production build. if "%~1"=="" ( echo Creating Optima production build. goto :myStart ) rem Handle Help commandline parameters if /i "%1"=="/?" goto :myHelp if /i "%1"=="-?" goto :myHelp if /i "%1"=="/h" goto :myHelp if /i "%1"=="-h" goto :myHelp if /i "%1"=="/help" goto :myHelp if /i "%1"=="-help" goto :myHelp rem Handle unknown commandline parameters set "BAD=" if /i NOT %1==dev set BAD=1 if /i NOT %1==prod set BAD=1 if defined BAD ( echo: echo Undefined parameter: %1 goto :myHelp ) :myStart rem Run the msbuild batch file for Visual Studio 2022/2019 Community/Professional if exist "%PROGRAMFILES%\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat" ( call "%PROGRAMFILES%\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat" echo Using Visual Studio 2022 Community msbuild. ) else if exist "%PROGRAMFILES(X86)%\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat" ( call "%PROGRAMFILES(X86)%\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat" echo Using Visual Studio 2019 Community msbuild. ) else if exist "%PROGRAMFILES%\Microsoft Visual Studio\2022\Professional\Common7\Tools\VsDevCmd.bat" ( call "%PROGRAMFILES%\Microsoft Visual Studio\2022\Professional\Common7\Tools\VsDevCmd.bat" echo Using Visual Studio 2022 Professional msbuild. ) else if exist "%PROGRAMFILES(X86)%\Microsoft Visual Studio\2019\Professional\Common7\Tools\VsDevCmd.bat" ( call "%PROGRAMFILES(X86)%\Microsoft Visual Studio\2019\Professional\Common7\Tools\VsDevCmd.bat" echo Using Visual Studio 2019 Professional msbuild. ) else ( echo "Can't find Visual Studio Tools. Verify VS install." goto :end ) rem Rename TIPro files. ren ..\..\TIpro\TIPro.sln TIPro_saved.sln ren ..\..\TIpro\TIPro.csproj TIPro_saved.csproj rem Copy the Optima files to the TIPro folder. copy /y .\TIPro.sln ..\..\TIpro\. copy /y .\TIPro.csproj ..\..\TIpro\. rem Delete \bin and \obj folders in TIPro project. if exist ..\..\TIpro\bin rmdir /s /q ..\..\TIpro\bin if exist ..\..\TIpro\obj rmdir /s /q ..\..\TIpro\obj rem Start building in the TIPro solution folder. cd ..\..\TIpro rem Clean projects. echo Clean all x86 Release projects... msbuild TIPro.sln -noLogo -v:quiet -ds -err -t:Clean -p:Configuration=Release;Platform=x86 if errorlevel 1 goto :myErrorFunc echo Clean all x64 Release projects... msbuild TIPro.sln -noLogo -v:quiet -ds -err -t:Clean -p:Configuration=Release;Platform=x64 if errorlevel 1 goto :myErrorFunc rem Build solution. echo Build all x86 projects... msbuild TIPro.sln -noLogo -v:quiet -ds -err -t:Build -p:Configuration=Release;Platform=x86 if errorlevel 1 goto :myErrorFunc echo Build x64 Release project... msbuild TIPro.sln -noLogo -v:quiet -ds -err -t:Build -p:Configuration=Release;Platform=x64 if errorlevel 1 goto :myErrorFunc rem Copy VC++ 2015-2022 Redistributable install files. rem We copy the vc_redist.x64.exe file. echo Copying VC++ 2015-2022 Redistributable install files bin folder. if exist "%PROGRAMFILES%\Microsoft Visual Studio\2022\Community\VC\Redist\MSVC\v143\vc_redist.x64.exe" ( copy "%PROGRAMFILES%\Microsoft Visual Studio\2022\Community\VC\Redist\MSVC\v143\vc_redist.x64.exe" bin\. ) else if exist "%PROGRAMFILES(X86)%\Microsoft Visual Studio\2019\Community\VC\Redist\MSVC\v142\vc_redist.x64.exe" ( copy "%PROGRAMFILES(X86)%\Microsoft Visual Studio\2019\Community\VC\Redist\MSVC\v142\vc_redist.x64.exe" bin\. ) else if exist "%PROGRAMFILES%\Microsoft Visual Studio\2022\Professional\VC\Redist\MSVC\v143\vc_redist.x64.exe" ( copy "%PROGRAMFILES%\Microsoft Visual Studio\2022\Professional\VC\Redist\MSVC\v143\vc_redist.x64.exe" bin\. ) else if exist "%PROGRAMFILES(X86)%\Microsoft Visual Studio\2019\Professional\VC\Redist\MSVC\v142\vc_redist.x64.exe" ( copy "%PROGRAMFILES(X86)%\Microsoft Visual Studio\2019\Professional\VC\Redist\MSVC\v142\vc_redist.x64.exe" bin\. ) else ( echo "Can't find VC++ 2015-2022 Redistributable install x64 files. Verify VS install." goto :end ) if %ERRORLEVEL% neq 0 ( echo Error copying vc_redist.x64.exe. Error = %ERRORLEVEL% goto :end ) echo Copied vc_redist.x64.exe. rem We copy the vc_redist.x86.exe. if exist "%PROGRAMFILES%\Microsoft Visual Studio\2022\Community\VC\Redist\MSVC\v143\vc_redist.x86.exe" ( copy "%PROGRAMFILES%\Microsoft Visual Studio\2022\Community\VC\Redist\MSVC\v143\vc_redist.x86.exe" bin\. ) else if exist "%PROGRAMFILES(X86)%\Microsoft Visual Studio\2019\Community\VC\Redist\MSVC\v142\vc_redist.x86.exe" ( copy "%PROGRAMFILES(X86)%\Microsoft Visual Studio\2019\Community\VC\Redist\MSVC\v142\vc_redist.x86.exe" bin\. ) else if exist "%PROGRAMFILES%\Microsoft Visual Studio\2022\Professional\VC\Redist\MSVC\v143\vc_redist.x86.exe" ( copy "%PROGRAMFILES%\Microsoft Visual Studio\2022\Professional\VC\Redist\MSVC\v143\vc_redist.x86.exe" bin\. ) else if exist "%PROGRAMFILES(X86)%\Microsoft Visual Studio\2019\Professional\VC\Redist\MSVC\v142\vc_redist.x86.exe" ( copy "%PROGRAMFILES(X86)%\Microsoft Visual Studio\2019\Professional\VC\Redist\MSVC\v142\vc_redist.x86.exe" bin\. ) else ( echo "Can't find VC++ 2015-2022 Redistributable install x86 file. Verify VS install." goto :end ) if %ERRORLEVEL% neq 0 ( echo Error copying vc_redist.x86.exe. Error = %ERRORLEVEL% goto :end ) echo Copied vc_redist.x86.exe. rem Start the Inno Setup section cd ..\TIPro_Install\Optima rem Start the Inno Setup section echo Creating Inno Setup x86 and x64 Production building in the ..\TIPro_Install\Optima\Output folder. echo The file is called Optima_x86_x64_setup.exe. rem Delete old production build if exist ".\Output\Optima_x86_x64_setup.exe" del ".\Output\Optima_x86_x64_setup.exe" "%PROGRAMFILES(X86)%\Inno Setup 6\ISCC.exe" /Q Optima_64_dual.iss if %ERRORLEVEL% neq 0 ( echo Error creating the Production/Beta Inno Setup executable build. Error = %ERRORLEVEL% goto :end ) rem Delete files copied to the TIPro folder. del ..\..\TIpro\TIPro.sln del ..\..\TIpro\TIPro.csproj rem Rename saved TIPro files. ren ..\..\TIpro\TIPro_saved.sln TIPro.sln ren ..\..\TIpro\TIPro_saved.csproj TIPro.csproj rem Delete \bin and \obj folders in TIPro project. if exist ..\..\TIpro\bin rmdir /s /q ..\..\TIpro\bin if exist ..\..\TIpro\obj rmdir /s /q ..\..\TIpro\obj echo Done! Find install file Optima_x86_x64_setup.exe in ..\TIPro_Install\Optima\Output folder. rem Exit without closing the command prompt. If we want the cmd prompt closed after build call exit (no parameters.) exit /b :myErrorFunc echo MSBuild falure errorlevel = %errorlevel% goto :end :myHelp echo: echo Batch file that will build the production build for Optima. echo Run the batch file Optima_MSBuild_x86_x64.bat, in a command prompt in the ..\TIPro_Install\Optima\ folder. echo Make sure Visual Studio is closed to avoid issues using the same build folders. echo The Inno Setup install executables are created in the ..\TIPro_install\Optima\Output folder. echo The batch files supports ONE commandline parameter which is NOT case sensative: DisplayHelp. echo DisplayHelp equal to "/?", "-?", "/h", "-h", "/help", or "-help" shows this help text. echo: goto :end @REM ------------------------------------------------------------------------ :end rem pause