202_publish_output.ps1 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #**************************************************************************#
  2. #** QUADARAX DEPLOYMENT SCRIPTS **#
  3. #** File: 202_publish_output.ps1 **#
  4. #** Description: PowerShell script library to publish current solution **#
  5. #** to output directory **#
  6. #** Version: 1.0. **#
  7. #** Updated: 29.7.2019 **#
  8. #**************************************************************************#
  9. param(
  10. # Solution file name with full path. If not defined use global solution
  11. [string] $solutionFile,
  12. # Build configuration Debug / Release. If not defined use Debug
  13. [string] $configurationName,
  14. # Defines if Clean will be called before build. If not defined use $false
  15. [bool] $cleanBeforeBuild
  16. )
  17. . ./000_bootstrap.ps1
  18. # Validate inputs
  19. if (!$solutionFile) { $solutionFile = $solutionName}
  20. if (!$configurationName) { $configurationName = $buildCfgDebug}
  21. if (!$cleanBeforeBuild) { $cleanBeforeBuild = $false}
  22. if ($configurationName -eq $buildCfgAll){
  23. Write-Host ("Configuration name {0} for this script is not allowed. Use only {1},{2}." -f $buildCfgAll, $buildCfgDebug, $buildCfgRelease) -ForegroundColor Red
  24. Break
  25. }
  26. # Script body section
  27. # May create output directory
  28. New-Item -ItemType Directory -Force -Path $projectOutputDir
  29. Write-Host "*** PUBLISH - START ***" -ForegroundColor Green
  30. $slnFullPath = ("{0}\{1}" -f $projectDir, $solutionFile)
  31. Write-Host ("Solution name: {0}" -f $slnFullPath) -ForegroundColor Yellow
  32. Write-host ("Configuration: {0}" -f $configurationName) -ForegroundColor Yellow
  33. Write-host ("Output directory: {0}" -f $projectOutputDir) -ForegroundColor Yellow
  34. if ($cleanBeforeBuild -eq $true){
  35. Write-Host "Cleaning output directory" -ForegroundColor White
  36. Remove-Item -Path "$projectOutputDir\*" -Recurse
  37. }
  38. PublishSolution -solutionFileName $slnFullPath -configurationName $configurationName -cleanBeforeBuild $cleanBeforeBuild
  39. Write-Host "*** PUBLISH - END ***" -ForegroundColor Green