38 lines
1.3 KiB
PowerShell
38 lines
1.3 KiB
PowerShell
# Fix xunit.v3 projects that conflict with Directory.Build.props xunit 2.x
|
|
# Add UseConcelierTestInfra=false to exclude them from common test infrastructure
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$srcPath = Join-Path $PSScriptRoot "..\..\src"
|
|
|
|
# Find all csproj files that reference xunit.v3
|
|
$xunitV3Projects = Get-ChildItem -Path $srcPath -Recurse -Filter "*.csproj" |
|
|
Where-Object { (Get-Content $_.FullName -Raw) -match "xunit\.v3" }
|
|
|
|
Write-Host "Found $($xunitV3Projects.Count) projects with xunit.v3" -ForegroundColor Cyan
|
|
|
|
$fixedCount = 0
|
|
|
|
foreach ($proj in $xunitV3Projects) {
|
|
$content = Get-Content $proj.FullName -Raw
|
|
|
|
# Check if already has UseConcelierTestInfra set
|
|
if ($content -match "<UseConcelierTestInfra>") {
|
|
Write-Host " Skipped (already configured): $($proj.Name)" -ForegroundColor DarkGray
|
|
continue
|
|
}
|
|
|
|
# Add UseConcelierTestInfra=false after the first <PropertyGroup>
|
|
$newContent = $content -replace "(<PropertyGroup>)", "`$1`n <UseConcelierTestInfra>false</UseConcelierTestInfra>"
|
|
|
|
# Only write if changed
|
|
if ($newContent -ne $content) {
|
|
Set-Content -Path $proj.FullName -Value $newContent -NoNewline
|
|
Write-Host " Fixed: $($proj.Name)" -ForegroundColor Green
|
|
$fixedCount++
|
|
}
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "Fixed $fixedCount projects" -ForegroundColor Cyan
|