Skip to content

Update CS0518 documentation with actionable guidance for modern .NET projects #47685

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 4, 2025

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 31, 2025

The CS0518 compiler error documentation previously provided vague guidance that told developers to "make sure that the project refers to the correct mscorlib.dll" without explaining how to actually do this. This left developers without actionable steps to resolve the error, particularly in modern SDK-style projects.

What changed

  • Added contextual guidance: Added a NOTE section explaining the difference between modern SDK-style projects and legacy project formats
  • Updated problem description: Clarified that the root cause varies between modern and legacy project systems
  • Added concrete examples: Provided specific .csproj configuration examples for both single-target and multi-target scenarios:
    <PropertyGroup>
      <TargetFramework>net8.0</TargetFramework>
    </PropertyGroup>
  • Modernized resolution steps: Prioritized SDK-style project guidance while preserving legacy information for backwards compatibility
  • Fixed formatting: Cleaned up orphaned "Optionally" section and improved overall structure

Why this matters

Modern .NET developers using SDK-style projects don't directly reference mscorlib.dll - the runtime libraries are managed automatically through the <TargetFramework> property. The previous documentation was focused on legacy .NET Framework scenarios and left modern developers without clear guidance.

The updated documentation now provides immediate, actionable steps that developers can follow to resolve CS0518 errors in their projects.

Fixes #30778.


💡 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.


Internal previews

📄 File 🔗 Preview link
docs/csharp/language-reference/compiler-messages/cs0518.md Compiler Error CS0518

@dotnet-policy-service dotnet-policy-service bot added the okr-quality Content-quality KR: Concerns article defects (bugs), freshness, or build warnings. label Jul 31, 2025
@Copilot Copilot AI changed the title [WIP] Poor doc Update CS0518 documentation with actionable guidance for modern .NET projects Jul 31, 2025
@Copilot Copilot AI requested a review from BillWagner July 31, 2025 16:16
Copilot finished work on behalf of BillWagner July 31, 2025 16:16
Copy link
Member

@BillWagner BillWagner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is ready for final review.

@BillWagner BillWagner marked this pull request as ready for review August 1, 2025 18:27
@BillWagner BillWagner requested a review from a team as a code owner August 1, 2025 18:27
@BillWagner BillWagner requested a review from tdykstra August 1, 2025 18:27
Copilot finished work on behalf of gewarren August 4, 2025 17:42
@Copilot Copilot AI requested a review from gewarren August 4, 2025 17:42
@BillWagner BillWagner merged commit 2b917e0 into main Aug 4, 2025
10 checks passed
@BillWagner BillWagner deleted the copilot/fix-30778 branch August 4, 2025 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
csharp-diagnostics/subsvc dotnet-csharp/svc lang-reference/subsvc okr-quality Content-quality KR: Concerns article defects (bugs), freshness, or build warnings.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Poor doc
3 participants