Enable C# nullable reference types and TreatWarningsAsErrors across the solution #192
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR implements centralized build configuration to enforce C# nullable reference types and treat all compiler warnings as errors across the entire Visage solution, improving code quality and null-safety.
Changes
1. Created
Directory.Build.propsAdded a centralized MSBuild configuration file at the solution root that automatically applies to all projects:
Benefits:
2. Enhanced CI/CD Pipeline
Updated
.github/workflows/dotnet.ymlto include a build step that compiles the solution in Release mode:This ensures that any warnings will cause CI builds to fail, enforcing code quality standards before code can be merged.
3. Documentation
Added a new "Code Quality and Build Configuration" section to
README.mdexplaining:Directory.Build.propsImplementation Notes
<Nullable>enable</Nullable>configured individually, demonstrating that the codebase already follows null-safety best practicesDirectory.Build.propsapproach centralizes configuration and ensures consistency across all existing and future projectsTesting
The solution builds successfully with these settings. Once the .NET 10 SDK is available in the CI environment, the GitHub Actions workflow will automatically enforce that no warnings are introduced.
Closes #[issue_number]
Original prompt
Fixes #191
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.