#**************************************************************************# #** QUADARAX DEPLOYMENT SCRIPTS **# #** File: 200_rebuild.ps1 **# #** Description: PowerShell script library to build current solution **# #** to output directory **# #** Version: 1.0. **# #** Updated: 26.7.2019 **# #**************************************************************************# param( # Solution file name with full path. If not defined use global solution [string] $solutionFile, # Build configuration Debug / Release. If not defined use Debug [string] $configurationName, # Defines if Clean will be called before build. If not defined use $false [bool] $cleanBeforeBuild ) . ./000_bootstrap.ps1 # Validate inputs if (!$solutionFile) { $solutionFile = $solutionName} if (!$configurationName) { $configurationName = $buildCfgDebug} if (!$cleanBeforeBuild) { $cleanBeforeBuild = $false} if ($configurationName -eq $buildCfgAll){ Write-Host ("Configuration name {0} for this script is not allowed. Use only {1},{2}." -f $buildCfgAll, $buildCfgDebug, $buildCfgRelease) -ForegroundColor Red Break } # Script body section # May create output directory New-Item -ItemType Directory -Force -Path $projectOutputDir Write-Host "*** REBUILD - START ***" -ForegroundColor Green $slnFullPath = ("{0}\{1}" -f $projectDir, $solutionFile) Write-Host ("Solution name: {0}" -f $slnFullPath) -ForegroundColor Yellow Write-host ("Configuration: {0}" -f $configurationName) -ForegroundColor Yellow Write-host ("Output directory: {0}" -f $projectOutputDir) -ForegroundColor Yellow if ($cleanBeforeBuild -eq $true){ Write-Host "Cleaning output directory" -ForegroundColor White Remove-Item -Path "$projectOutputDir\*" -Recurse } RebuildSolution -solutionFileName $slnFullPath -configurationName $configurationName -cleanBeforeBuild $cleanBeforeBuild # Gathering projects $projects = GetProjectsFromSolution $slnFullPath # Copy outputs foreach ($project in $projects) { $projectBuildOutput = "$($project.Directory)\bin\$configurationName\*" $ignoreThisProject = Test-Path -Path "$($project.Directory)\.skipoutput" if ($ignoreThisProject -eq $false){ Copy-Item -Path $projectBuildOutput -Filter * -Destination $projectOutputDir -Force -Recurse Write-Host ("Files was copied from $($project.Directory) to $projectOutputDir") } } Write-Host "*** REBUILD - END ***" -ForegroundColor Green