Skip to content

Suppress CS1701 and CS1702 warnings by default in RoslynCodeTaskFactory to align with .NET SDK #12101

@rainersigwald

Description

@rainersigwald

Issue Description

When using RoslynCodeTaskFactory, MSBuild emits CS1701 and CS1702 assembly binding warnings for version mismatches (e.g., between System.Memory and System.Text.Json). The .NET SDK and Roslyn suppress these warnings by default because they are not actionable in modern .NET scenarios, but MSBuild does not. This leads to unnecessary warning noise and confusion in custom task or non-SDK builds.

References:

Steps to Reproduce

  • Use RoslynCodeTaskFactory with a .cs file referencing mismatched System.Memory and System.Text.Json versions.
  • Observe CS1701 and CS1702 warnings in MSBuild output (not present in .NET SDK-based builds).

Expected Behavior
Warnings CS1701 and CS1702 should be suppressed by default when RoslynCodeTaskFactory is running on .NET Core.

Actual Behavior
Warnings are emitted, unlike SDK-based builds.

Analysis
Aligning MSBuild with .NET SDK and Roslyn would simplify the experience for users and avoid confusion.

Versions & Configurations
See attached binlog and environment details in user reports.

User impact and context:
See roslyn#19640 for more details.

Metadata

Metadata

Labels

Area: CodeTaskFactoryIssues related to building a task during the build using CodeTaskFactory or RoslynCodeTaskFactory.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions