# PowerShell script to fix project file formatting issues
# Get all .csproj files
$projectFiles = Get-ChildItem -Path "." -Recurse -Name "*.csproj" | ForEach-Object { $_ }
foreach ($projectFile in $projectFiles) {
if (Test-Path $projectFile) {
Write-Host "Fixing $projectFile"
# Read the file content
$content = Get-Content $projectFile -Raw
# Fix the malformed LangVersion line
$content = $content -replace '([^<]+)`n\s*8\.0', '$1`n 8.0'
# Remove extra empty lines at the end
$content = $content -replace '\n\n\n+$', "`n"
# Ensure proper line endings
$content = $content -replace '\r\n', "`n"
$content = $content -replace '\n', "`r`n"
# Write the updated content back to the file
Set-Content $projectFile -Value $content -Encoding UTF8 -NoNewline
Write-Host "Fixed $projectFile"
}
}
Write-Host "All project files have been fixed."