Skip to content
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

Disable or refine RS1041? #7470

Open
rmannibucau opened this issue Nov 13, 2024 · 3 comments
Open

Disable or refine RS1041? #7470

rmannibucau opened this issue Nov 13, 2024 · 3 comments

Comments

@rmannibucau
Copy link

RS1041 triggers when used with .net9, it is unlikely, in particular in (incremental) source generators used in the context of a single project (not intended to be consumed or intended to be consumed by the same net framework).
Forcing to use netframework2.0 is oddish so think this rule is not that accurate as of today

@joshendriks
Copy link

In case you are sure that you will not need net framework support just create a .cs in your project with the following content:

[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(
    "RoslynDiagnostics",
    "RS1041:Do not use obsoleted APIs",
    Justification = "Suppression is necessary for this project.")]

Alternatively disbale the rul in your ruleset or editorconfig. I prefer having it in c# code

Now that the rule is ignored you can set the target framework to net8.0

@rmannibucau
Copy link
Author

@joshendriks goal here is to have a good default and not need to be explicit. msbuild has all the meta to auto disable it

@joshendriks
Copy link

@rmannibucau Yes, agreed, this is a workaround

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants