-
Notifications
You must be signed in to change notification settings - Fork 467
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
Roslyn plugins (analyzers, source generators) target .NET 8 instead of .NET Standard 2.0 #7302
Comments
Could you give a more concrete example on what you are trying to achieve and why the referenced project needs to be a net8.0 instead of a netstandard2.0 project? |
I'm trying to reference a net8.0 project (by project reference) from my analyzer. This requires that my analyzer targets net8.0 instead of .netcore 3.1. The referenced project is net8.0 because this is the latest version. The upgrade of the analyzer requires that the other projects are updated too (CodeFixes, Package, Test. VSIX). I upgraded all projects and managed to get them building, but when I add the analyzer nuget package to a project and start the code analysis, nothing happens (no errors). |
There are multiple issues on this matter already, e.g. dotnet/roslyn#47087 and dotnet/roslyn#45162, so unfortunately targeting |
This is effectively a duplicate of #45162.
Many cases where we have seen this in the past, the analyzer did not need to reference the project at all, and removing the reference resolved the matter. For remaining cases, the referenced project can multi-target netstandard2.0 and net8.0 to support both scenarios it is being used for. |
I'm trying to reference a .net 8.0 project but the Roslyn analyzer requires .netstandard 2.0 which makes this not possible.
Similar issue: https://developercommunity.visualstudio.com/t/Please-enable-Roslyn-plugins-analyzers/10616185?space=41&sort=newest
As far as I can find out it is not possible to reference .net 8 projects from the analyzer?
The text was updated successfully, but these errors were encountered: