install.bat 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. @echo off
  2. echo ###################################################################################
  3. echo (Frank: 4/12/25) More Improvements to the install process
  4. echo - You can now select Debug or Release for the build configuration
  5. echo - PRSLogikal is built using MSBuild, rather than dotnet.exe
  6. echo - Nuget Packages are saved to a common folder for publishing
  7. echo ###################################################################################
  8. echo.
  9. set /p version_number="Enter Version Number (major.minor.release): "
  10. setlocal
  11. echo(%version_number%| findstr /R /C:"^[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$" >nul
  12. if errorlevel 1 (
  13. echo Invalid version format.
  14. exit /b 1
  15. )
  16. endlocal
  17. set release_type=Release
  18. set package_folder="c:\development\packages"
  19. echo Build Configuration is %release_type%.
  20. echo Building PRSDesktop...
  21. dotnet build ../prs.desktop/prsdesktop.csproj -c %release_type% -p:Version=%version_number% -p:PackageOutputPath=%package_folder% > build.log 2>&1 || goto :build_fail
  22. echo Building PRSServer...
  23. dotnet build ../prs.server/prsserver.csproj -c %release_type% -p:Version=%version_number% -p:PackageOutputPath=%package_folder% > build.log 2>&1 || goto :build_fail
  24. echo Building PRSLicensing...
  25. dotnet build ../prs.licensing/prslicensing.csproj -c %release_type% -p:Version=%version_number% -p:PackageOutputPath=%package_folder% > build.log 2>&1 || goto :build_fail
  26. echo Building PRSRecovery...
  27. dotnet build ../prs.recovery/prsrecovery.csproj -c %release_type% -p:Version=%version_number% -p:PackageOutputPath=%package_folder% > build.log 2>&1 || goto :build_fail
  28. echo Building PRS.Avalonia.Desktop...
  29. dotnet build ../prs.avalonia/prs.avalonia.desktop/prs.avalonia.desktop.csproj -c %release_type% -p:Version=%version_number% -p:PackageOutputPath=%package_folder% > build.log 2>&1 || goto :build_fail
  30. echo Building PRS.DigitalKey.Desktop...
  31. dotnet build ../prs.digitalkey/prs.digitalkey.desktop/prs.digitalkey.desktop.csproj -c %release_type% -p:Version=%version_number% -p:PackageOutputPath=%package_folder% > build.log 2>&1 || goto :build_fail
  32. echo Building PRSLogikal...
  33. setlocal EnableDelayedExpansion
  34. set "buildlocations[0]=C:\Users\frank.vandenbos\AppData\Local\JetBrains\BuildTools\MSBuild\Current\Bin\MSBuild.exe"
  35. set "buildlocations[1]=C:\Program Files\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe"
  36. set "buildlocations[2]=C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe"
  37. set "buildlocations[3]=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe"
  38. set "buildlocations[4]=C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe"
  39. set "buildlocations[5]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe"
  40. set "buildlocations[6]=C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe"
  41. set "msbuild="
  42. set "foundlocation="
  43. for /l %%i in (0,1,6) do (
  44. call set "location=%%buildlocations[%%i]%%"
  45. if exist "!location!" (
  46. set "foundlocation=!location!"
  47. goto :found
  48. )
  49. )
  50. echo MSBuild.exe not found in known locations.
  51. endlocal
  52. exit /b 1
  53. :found
  54. endlocal & set "msbuild=%foundlocation%
  55. echo Found MSBuild at: %msbuild%
  56. %msbuild% ../prs.logikal/prslogikal.csproj -p:Configuration=%release_type% > build.log 2>&1 || goto :build_fail
  57. goto :build_success
  58. :build_fail
  59. findstr /i ": error" build.log
  60. echo Build failed. Aborting script.
  61. exit /b %ERRORLEVEL%
  62. )
  63. :build_success
  64. echo Updating Version Number...
  65. set /p _scratch="%version_number%" <nul > "bin/%release_type%/net8.0-windows/update/version.txt"
  66. set /p _scratch="%version_number%" <nul > "bin/%release_type%/net8.0-windows/version.txt"
  67. >NUL mkdir "bin/%release_type%/net8.0-windows/update"
  68. echo Getting Release Notes...
  69. curl.exe -s "https://prsdigital.com.au//updates/prs/Release%%20Notes.txt" > "bin/%release_type%/net8.0-windows/update/Release Notes.txt"
  70. echo Preparing Desktop Installer Script...
  71. powershell -Command "(gc ../prs.desktop/prsdesktop.iss) -replace '#define MyAppVersion ""[^\""]*""', '#define MyAppVersion """%version_number%"""' | Out-File -encoding ASCII ../prs.desktop/prsdesktop.iss"
  72. powershell -Command "(gc ../prs.desktop/prsdesktop.iss) -replace '#define ReleaseType ""[^\""]*""', '#define ReleaseType """%release_type%"""' | Out-File -encoding ASCII ../prs.desktop/prsdesktop.iss"
  73. powershell -Command "(gc ../prs.desktop/prsdesktop.iss) -replace 'OutputDir=[^\""]*', 'OutputDir=%~dp0bin\%release_type%\net8.0-windows\update' | Out-File -encoding ASCII ../prs.desktop/prsdesktop.iss"
  74. powershell -Command "(gc ../prs.desktop/prsdesktop.iss) -replace 'SourceDir=[^\""]*', 'SourceDir=%~dp0..\prs.desktop\' | Out-File -encoding ASCII ../prs.desktop/prsdesktop.iss"
  75. echo Preparing Server Installer Script...
  76. powershell -Command "(gc PRSServer.iss) -replace '#define MyAppVersion ""[^\""]*""', '#define MyAppVersion """%version_number%"""' | Out-File -encoding ASCII PRSServer.iss"
  77. powershell -Command "(gc PRSServer.iss) -replace '#define ReleaseType ""[^\""]*""', '#define ReleaseType """%release_type%"""' | Out-File -encoding ASCII PRSServer.iss"
  78. powershell -Command "(gc PRSServer.iss) -replace 'OutputDir=[^\""]*', 'OutputDir=%~dp0' | Out-File -encoding ASCII PRSServer.iss"
  79. powershell -Command "(gc PRSServer.iss) -replace 'SourceDir=[^\""]*', 'SourceDir=%~dp0' | Out-File -encoding ASCII PRSServer.iss"
  80. echo Preparing Licensing Installer Script...
  81. powershell -Command "(gc ../prs.licensing/prslicensing.iss) -replace '#define MyAppVersion ""[^\""]*""', '#define MyAppVersion """%version_number%"""' | Out-File -encoding ASCII ../prs.licensing/prslicensing.iss"
  82. powershell -Command "(gc ../prs.licensing/prslicensing.iss) -replace '#define ReleaseType ""[^\""]*""', '#define ReleaseType """%release_type%"""' | Out-File -encoding ASCII ../prs.licensing/prslicensing.iss"
  83. powershell -Command "(gc ../prs.licensing/prslicensing.iss) -replace 'OutputDir=[^\""]*', 'OutputDir=%~dp0bin\%release_type%\net8.0-windows\update' | Out-File -encoding ASCII ../prs.licensing/prslicensing.iss"
  84. powershell -Command "(gc ../prs.licensing/prslicensing.iss) -replace 'SourceDir=[^\""]*', 'SourceDir=%~dp0..\prs.licensing\' | Out-File -encoding ASCII ../prs.licensing/prslicensing.iss"
  85. echo Compiling Desktop Installer...
  86. "C:\Program Files (x86)\Inno Setup 6\iscc.exe" /Qp /O"bin\%release_type%\net8.0-windows\update" ../prs.desktop/prsdesktop.iss
  87. echo Compiling Server Installer...
  88. "C:\Program Files (x86)\Inno Setup 6\iscc.exe" /Qp /O"." /F"PRSSetup" PRSServer.iss
  89. echo Compiling License Installer...
  90. "C:\Program Files (x86)\Inno Setup 6\iscc.exe" /Qp /O"." /F"PRSLicensing" ../prs.licensing/prslicensing.iss
  91. echo Cleaning Up...
  92. del bin\%release_type%\net8.0-windows\update\version.txt
  93. del bin\%release_type%\net8.0-windows\version.txt
  94. echo.
  95. echo All Done! PRS v%version_number% Installer can be found at %~dp0PRSSetup.exe