Skip to content

Warnings CS1701 and CS1702 should be removed #19640

Open
@nguerrera

Description

@nguerrera

These warnings assume runtime behavior that only holds on full .NET framework: that you need to supply "policy" to bind a ref to a lower assembly to a higher version. This means that the warnings have to be disabled when targeting other .NET platforms

Furthermore, even when targeting .NET Framework, msbuild will also warn and so removing these warnings doesn't prevent our greater build ecosystem from diagnosing the issue where it actually applies. Plus, msbuild actually understands app.config binding redirects in making the call on whether to warn, and it can even generate a correct one for you (via AutoGenerateBindingRedirects=true), which it recommends in its warning.

These warnings have had to be disabled in project templates for a long time. Searching for "NoWarn" 1701 on GitHub yields 250K results: https://github.com/search?q=NoWarn+1701&type=Code&utf8=%E2%9C%93

dotnet/sdk disables them for you to avoid cluttering your csproj, but this opens up issues around the ordering of NoWarn between user and SDK. I'd like to get the SDK out of the business of disabling warnings. Over the past several years, the only times I see 1701 is when a build misconfiguration has undone a vital NoWarn, and nobody can decipher the message. e.g. dotnet/sdk#1205

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Active/Investigating

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions