Created
August 10, 2017 22:01
-
-
Save carusology/0903a928a918493fe6d9f6ec2ae5e2d3 to your computer and use it in GitHub Desktop.
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
Param([string]$debugType = "full") | |
$ErrorActionPreference = "Stop" | |
Function Get-Debug-Type { | |
Param([string]$projectName) | |
$project = New-Object XML | |
$project.Load("${pwd}\src\${projectName}\${projectName}.csproj") | |
return $project.Project.PropertyGroup.DebugType; | |
} | |
Function Set-Debug-Type { | |
Param([string]$projectName, [String]$debugType) | |
Copy-Item "src\${projectName}\${projectName}.csproj" "src\${projectName}\${projectName}.csproj.bak" | |
$project = New-Object XML | |
$project.Load("${pwd}\src\${projectName}\${projectName}.csproj") | |
$project.Project.PropertyGroup.DebugType = $debugType | |
$project.Save("${pwd}\src\${projectName}\${projectName}.csproj") | |
} | |
try { | |
Write-Host "-- Setting Project DebugTypes --" | |
foreach ($projectName in Get-ChildItem ./src -Name) { | |
Write-Host " Processing '${projectName}'..." | |
$previousDebugType = Get-Debug-Type $projectName | |
if ($previousDebugType -eq $debugType) { | |
Write-Host " '${projectName}' already has a DebugType of '${debugType}'. Skipping..." | |
continue; | |
} | |
Set-Debug-Type $projectName $debugType | |
$newDebugType = Get-Debug-Type $projectName | |
Write-Host " Set '${projectName}' DebugType from '${previousDebugType}' to '${newDebugType}'" | |
} | |
exit 0 | |
} catch [Exception] { | |
Write-Host $_.Exception | |
exit 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment