Last active
November 12, 2019 18:53
-
-
Save jmarkman/d0a0da4089225e85eb230c561733952e to your computer and use it in GitHub Desktop.
Used at work, but might be useful in the future: builds all of the projects associated with the hardcoded solution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.Synopsis | |
Build AutomationSupport and all associated projects without opening Visual Studio | |
#> | |
function Build_QA($Drive = "C") | |
{ | |
# https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-command-line-reference?view=vs-2015 | |
# Path to qa_automation repo | |
$qaRepoDir = | |
Get-ChildItem "$($Drive):" -Recurse | | |
Where-Object {$_.PSIsContainer -eq $true -and $_.Name -match "qa_automation"} | | |
Foreach-Object {$_.FullName} | |
# Path to AutomationSupport | |
$AutomationSupportProj = Join-Path -Path $qaRepoDir -ChildPath "AutomationComponents\AutomationSupport" | |
# Hardcoded path to MSBuild on the local machine | |
$MSBuild = "C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" | |
$NuGet = | |
Get-ChildItem -Path "C:\Program Files (x86)" -Recurse -ErrorAction SilentlyContinue -Filter "NuGet.exe" | | |
ForEach-Object {$_.FullName} | |
if (!$NuGet) | |
{ | |
Write-Host "Could not find an instance of NuGet on the local machine!" -BackgroundColor Red -ForegroundColor White | |
Write-Host "Please check that Ranorex has it installed or download a copy from https://www.nuget.org/downloads" | |
break | |
} | |
# Build AutomationSupport | |
Set-Location -Path $AutomationSupportProj | |
& $NuGet restore AutomationSupport.sln | |
Write-Host "`nBuilding AutomationSupport...`n" -ForegroundColor DarkGray -BackgroundColor Yellow | |
& $MSBuild -clp:ErrorsOnly -maxcpucount:4 AutomationSupport.sln | |
Write-Host "`nAutomationSupport built!`n" -ForegroundColor White -BackgroundColor DarkGreen | |
Set-Location "C:\Users\$($env:USERNAME)" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment