diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index e0aa9f9..d0ba74a 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -49,6 +49,7 @@ jobs: - name: Check Code Formatting run: | + # dotnet format is built into .NET 6+ SDK (no separate installation needed) # Find solution file solution=$(find . -maxdepth 2 \( -name "*.sln" -o -name "*.slnx" \) | head -n 1) diff --git a/README-FORMATTING.md b/README-FORMATTING.md index 969e094..cc6816e 100644 --- a/README-FORMATTING.md +++ b/README-FORMATTING.md @@ -2,6 +2,12 @@ This repository uses `dotnet format` to enforce consistent C# code style. +## Prerequisites + +The `dotnet format` command is **built into the .NET SDK** starting with .NET 6 and later. Since this project requires .NET 8.0 SDK or later, you already have `dotnet format` available — no separate tool installation is needed. + +> **Note:** The standalone `dotnet-format` global tool was deprecated when `dotnet format` was integrated into the .NET 6 SDK in August 2021. + ## For Developers ### Before Committing diff --git a/README.md b/README.md index 2f9c0fe..ae682e0 100644 --- a/README.md +++ b/README.md @@ -167,7 +167,7 @@ This project is licensed under the **MIT License**. See the [LICENSE](LICENSE) f - **API Documentation:** Generated via DocFX (see `docfx_project/`) - **Formatting Guide:** [README-FORMATTING.md](README-FORMATTING.md) -- **Setup Instructions:** [SETUP.md](SETUP.md) +- **Contributing Guide:** [CONTRIBUTING.md](CONTRIBUTING.md) --- diff --git a/format.ps1 b/format.ps1 index be7176c..a0cf415 100644 --- a/format.ps1 +++ b/format.ps1 @@ -28,6 +28,27 @@ $ErrorActionPreference = "Stop" Write-Host "🎨 Code Formatting Script" -ForegroundColor Cyan Write-Host "" +# Verify dotnet format is available (built into .NET 6+ SDK) +Write-Host "🔍 Checking for dotnet format..." -ForegroundColor Yellow +dotnet format --version | Out-Null + +if ($LASTEXITCODE -ne 0) +{ + Write-Host "" + Write-Host "❌ dotnet format is not available!" -ForegroundColor Red + Write-Host "" + Write-Host "The 'dotnet format' command is built into the .NET SDK starting with .NET 6." -ForegroundColor Yellow + Write-Host "This project requires .NET 8.0 SDK or later." -ForegroundColor Yellow + Write-Host "" + Write-Host "Please install the .NET 8.0 SDK or later from:" -ForegroundColor Yellow + Write-Host "https://dotnet.microsoft.com/download" -ForegroundColor Cyan + Write-Host "" + exit 1 +} + +Write-Host "✅ dotnet format is available" -ForegroundColor Green +Write-Host "" + # Find solution file $solutions = Get-ChildItem -Path . -File | Where-Object { $_.Extension -eq '.sln' -or $_.Extension -eq '.slnx' } | Select-Object -First 1