Skip to content

Instantly share code, notes, and snippets.

@carusology
Created August 10, 2017 22:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carusology/0903a928a918493fe6d9f6ec2ae5e2d3 to your computer and use it in GitHub Desktop.
Save carusology/0903a928a918493fe6d9f6ec2ae5e2d3 to your computer and use it in GitHub Desktop.
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