Fix csproj encoding issue in workflow
All checks were successful
Build / build (push) Successful in 8h0m9s
Build and Release / build (push) Successful in 9h0m16s

Use System.IO.File methods with UTF-8 BOM to preserve special characters

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
David H. Friedel Jr. 2026-01-07 11:52:10 -05:00
parent 526974da24
commit 77e9b0505a

View File

@ -23,15 +23,19 @@ jobs:
$version = "${{ gitea.ref_name }}".TrimStart("v")
Write-Host "Setting version to: $version"
# Update csproj
# Update csproj (preserve UTF-8 BOM encoding)
$csprojPath = "DellMonitorControl/DellMonitorControl.csproj"
(Get-Content $csprojPath) -replace '<Version>.*</Version>', "<Version>$version</Version>" | Set-Content $csprojPath
(Get-Content $csprojPath) -replace '<AssemblyVersion>.*</AssemblyVersion>', "<AssemblyVersion>$version.0</AssemblyVersion>" | Set-Content $csprojPath
(Get-Content $csprojPath) -replace '<FileVersion>.*</FileVersion>', "<FileVersion>$version.0</FileVersion>" | Set-Content $csprojPath
$content = [System.IO.File]::ReadAllText($csprojPath)
$content = $content -replace '<Version>.*</Version>', "<Version>$version</Version>"
$content = $content -replace '<AssemblyVersion>.*</AssemblyVersion>', "<AssemblyVersion>$version.0</AssemblyVersion>"
$content = $content -replace '<FileVersion>.*</FileVersion>', "<FileVersion>$version.0</FileVersion>"
[System.IO.File]::WriteAllText($csprojPath, $content, [System.Text.UTF8Encoding]::new($true))
# Update ISS
$issPath = "DellMonitorControl/MonitorControl.iss"
(Get-Content $issPath) -replace '#define MyAppVersion ".*"', "#define MyAppVersion `"$version`"" | Set-Content $issPath
$issContent = [System.IO.File]::ReadAllText($issPath)
$issContent = $issContent -replace '#define MyAppVersion ".*"', "#define MyAppVersion `"$version`""
[System.IO.File]::WriteAllText($issPath, $issContent, [System.Text.UTF8Encoding]::new($true))
- name: Restore dependencies
run: dotnet restore