install.bat 6.6 KB

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