You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
project.assets.json should indicate "analyzer" assets like "compile" and "runtime" #6279
"analyzer" assets should work like "compile" and "runtime" and the SDK should resolve them the same way. The current mechanism blocks respecting PrivateAssets and ExcludeAssets=analyzers
Reacted by Justin Emgarten, Ashish Jain, Scott, Andrew Arnott, Viktor Hofer, David Federman, Richard Simpson, AIDA, Dave Glick, Benny Coomans and 56 more
Analyzers were added without work being done on the NuGet side originally. We should add it to project.assets.json so that the SDK can switch over to using that instead of reading packages directly to find the analyzers folder.
This seems pretty broken. It means that analyzers don't respect the PrivateAssets or flags specified on the PacakgeReference (I see a few people suffering from this already today).
See also dotnet/sdk#968 (comment) that notes that PrivateAssets="all" can prevent analyzers from flowing, if you can afford to prevent all other package assets from flowing.
if someone search a hack to be able to do something like ExcludeAssets=analyzers (in my case StyleCop.Analyzers) , i found an old tweet https://twitter.com/Nick_Craver/status/1173996405276467202?s=09 who help me a lot to do it , added this on my .csproj
yes but this is not fixing the problem but rather covering up the problem - when someone is developing nuget package there should be readme with info - just add .editorconfig to hide warnings from analyzers you are not expecting :)
yes but this is not fixing the problem but rather covering up the problem - when someone is developing nuget package there should be readme with info - just add .editorconfig to hide warnings from analyzers you are not expecting :)
Of course, it's just a workaround. Fixing the underlying issue is still very much needed. This is just to unblock...
Activity
emgarten commentedon Dec 11, 2017
Analyzers were added without work being done on the NuGet side originally. We should add it to project.assets.json so that the SDK can switch over to using that instead of reading packages directly to find the analyzers folder.
nguerrera commentedon Dec 23, 2017
Related to this, is there a spec for how analyzer assets should be selected based on project language?
Current implementations are here:
https://github.com/NuGet/NuGet.BuildTasks/blob/1d8af3499f94a32c1d128a42faceade39c1f4337/src/Microsoft.NuGet.Build.Tasks/ResolveNuGetPackageAssets.cs#L444-L470
https://github.com/dotnet/sdk/blob/634680ab0ae045ba45977b6293b46f95a0385aac/src/Tasks/Microsoft.NET.Build.Tasks/ResolvePackageDependencies.cs#L251-L272
I believe they are semantically equivalent, but both have some strange behavior if I'm reading correctly.
("*/cs/*" or not "*/vb/*")and VB matches("*/vb/*" or not "*/cs/*")?cc @jinujoseph @natidea @jasonmalinowski
jasonmalinowski commentedon Dec 23, 2017
Adding @jmarolf too.
I think that was just the code trying to be tricky and deal with the "no language either" thing at the same time.
nguerrera commentedon Jan 23, 2018
cc @davidfowl
davidfowl commentedon Jan 23, 2018
This seems pretty broken. It means that analyzers don't respect the PrivateAssets or flags specified on the PacakgeReference (I see a few people suffering from this already today).
nguerrera commentedon Jan 23, 2018
Yes, it is pretty broken. See two linked sdk bugs that are blocked on this.
roryprimrose commentedon Feb 7, 2018
I have to run this powershell on my builds as a workaround using the parameters
-path $(Build.SourcesDirectory) -packageName $(Build.DefinitionName)davidfowl commentedon Feb 14, 2018
@rrelyea I see this is both a pri 0 and on the backlog. Any chance we can re-triage this?
nguerrera commentedon Aug 3, 2018
See also dotnet/sdk#968 (comment) that notes that PrivateAssets="all" can prevent analyzers from flowing, if you can afford to prevent all other package assets from flowing.
59 remaining items
Add setting and behavior to skip checks if dependency isn't direct
MeikelLP commentedon Jul 25, 2024
Still unable to exclude analyzers after 7 years...
Drmorph commentedon Aug 8, 2024
if someone search a hack to be able to do something like ExcludeAssets=analyzers (in my case StyleCop.Analyzers) , i found an old tweet https://twitter.com/Nick_Craver/status/1173996405276467202?s=09 who help me a lot to do it , added this on my .csproj
dominikjeske commentedon Oct 4, 2024
Any updates on this?
davidebbo commentedon Oct 31, 2024
That seems like a really bad issue, because those analyzers end up being viral. In my scenario:
UFX.Relay, which uses PackageNerdbank.StreamsNerdbank.Streamsdepends on severalMicrosoft.VisualStudio.*analyzer packagesAnd the end result is that every single project in my solution gets those unwanted analyzers.
Is there a way to disable them globally in the solution? Doing it at project level is quite painful...
AArnott commentedon Oct 31, 2024
@davidebbo Yes, just add an .editorconfig file in the root of your solution and set the severity for each analyzer to
Nonethat you don't want to see.davidebbo commentedon Nov 1, 2024
@AArnott ah yes, that's a much better solution, thanks!
e.g. (but you don't need to manually edit it if you do it through the designer):
dominikjeske commentedon Nov 2, 2024
yes but this is not fixing the problem but rather covering up the problem - when someone is developing nuget package there should be readme with info - just add .editorconfig to hide warnings from analyzers you are not expecting :)
davidebbo commentedon Nov 2, 2024
Of course, it's just a workaround. Fixing the underlying issue is still very much needed. This is just to unblock...
fix: Fixed the packaging of the analyzers, their false errors and a m…