Remove stryker thresholds configuration, add script to fix duplicate projects in solution, and create new solution file for StellaOps.Router with project references.
This commit is contained in:
55
devops/scripts/fix-duplicate-projects.ps1
Normal file
55
devops/scripts/fix-duplicate-projects.ps1
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env pwsh
|
||||
# fix-duplicate-projects.ps1 - Remove duplicate project entries from solution file
|
||||
|
||||
param(
|
||||
[string]$SlnPath = "src/StellaOps.sln"
|
||||
)
|
||||
|
||||
$content = Get-Content $SlnPath -Raw
|
||||
$lines = $content -split "`r?`n"
|
||||
|
||||
$projectNames = @{}
|
||||
$duplicateGuids = @()
|
||||
$newLines = @()
|
||||
$skipNextEndProject = $false
|
||||
|
||||
foreach ($line in $lines) {
|
||||
if ($skipNextEndProject -and $line -eq "EndProject") {
|
||||
$skipNextEndProject = $false
|
||||
continue
|
||||
}
|
||||
|
||||
if ($line -match 'Project\(.+\) = "([^"]+)",.*\{([A-F0-9-]+)\}"?$') {
|
||||
$name = $Matches[1]
|
||||
$guid = $Matches[2]
|
||||
|
||||
if ($projectNames.ContainsKey($name)) {
|
||||
$duplicateGuids += $guid
|
||||
Write-Host "Removing duplicate: $name ($guid)"
|
||||
$skipNextEndProject = $true
|
||||
continue
|
||||
} else {
|
||||
$projectNames[$name] = $true
|
||||
}
|
||||
}
|
||||
|
||||
$newLines += $line
|
||||
}
|
||||
|
||||
# Also remove duplicate GUIDs from GlobalSection
|
||||
$finalLines = @()
|
||||
foreach ($line in $newLines) {
|
||||
$skip = $false
|
||||
foreach ($guid in $duplicateGuids) {
|
||||
if ($line -match $guid) {
|
||||
$skip = $true
|
||||
break
|
||||
}
|
||||
}
|
||||
if (-not $skip) {
|
||||
$finalLines += $line
|
||||
}
|
||||
}
|
||||
|
||||
$finalLines | Out-File -FilePath $SlnPath -Encoding UTF8 -NoNewline
|
||||
Write-Host "`nRemoved $($duplicateGuids.Count) duplicate projects"
|
||||
Reference in New Issue
Block a user