-
Notifications
You must be signed in to change notification settings - Fork 4k
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
FxCop beta - Analyzer cannot be created. Needs Microsoft.CodeAnalysis 2.6.0 #23083
Comments
Moving fxcop down to 2.3.0-beta2-62118-03 allows it to work. Would still like to know where to dig out the requires Microsoft.CodeAnaylsis for the later versions. Thanks... |
@jhealy the version on myget has not been released, it's based on version 2.6.0-beta3-62227-02 of codeanalysis. I'd suggest sticking to the publicly-released version of the analyzers, available here. When VS 2017 update 5 is released (due before the end of the year), we will be updating all the analyzers built from https://github.com/dotnet/roslyn-analyzers, including the FxCopAnalyzers package. |
My real angle on this is I'm hoping the newer ones pickup more dispose/memory leaks. "big ole customer" trying to take core system to prod and its wuffing out miserably. Found a few dispose/lock contention manually, but hoping new core analyzers did better job. Thanks for the advice btw. I'm a PFE - jhealy@youknowwhere. |
Awkwardly made it here, irrespective of reading jhealy's article on this very topic. It seems that as of a few days ago these analyzers all released a new version (mostly 2.6.0-beta2) that seem to depend on Microsoft.CodeAnalysis 2.6.0 (which was also released at the same time) but don't seem able to actually reference this assembly correctly for some reason? Perhaps they are depending on the wrong version or something? I am getting the same errors as the original post. Feeling a bit confused as to why it's stuffed. Using the versions recommended to @jhealy in this topic works for me. |
@peabnuts123 technically, beta2 is depending on a prerelease version of Microsoft.CodeAnalysis, but there were no API changes between the version it depended on and the official release version. Could you share the exact versions you're using, and what environment you're seeing these issues in? beta2 should run with the released version of 2.6.0 without any issues. |
I am still trying to wrap my head around how this stuff works so I'm assuming there is something obviously wrong with my setup. I am on OSX using dotnet core with a netcoreapp2.0 project. My csproj is as follows: I am attempting to get some Code Analysis happening as this project is ~mostly being worked on by non-C# people. I am using VSCode for dev and so all of this stuff is happening on the CLI, not through Visual Studio. After adding the packages above and running the app I get the following:
Apologies for wall of text. As far as I can tell, all of the DLLs listed exist on disk (
Which to me says it can't find Microsoft.CodeAnalysis 2.6.0 despite the fact that I do have it installed, though it does not seem to have a dll under
If I downgrade the |
@peabnuts123 you'll also need the 2.6.0 version of As to running the analyzers in VSCode/non-VS scenarios, that is an area we're actively investigating. But it does not yet exist. |
I went down the
|
Ah, right, you're on a Mac. @peabnuts123, what version of dotnet core are you running? Sounds like you could be running on a old version. |
I am on
|
I do believe the package |
You should upgrade to the latest release version, which is 2.1.2 as of writing this comment. And yes, that's what I meant by that comment: you are correct, Microsoft.Net.Compilers will only run on full .NET Framework. |
My goodness, it's all working! That was a bit confusing though, as the dotnet core repo seems to link to an old version? I just downloaded 2.0.3 from there thinking it was the latest release. It wasn't until you told me about 2.1.2 that a google search led me to the actual https://dot.net website. Thanks for your help @333fred |
Yeah, they have an open issue for that here: dotnet/core#1147 (comment). |
Hi,
Another problem is... when my code is built on a build-mashine by msbuild, I get error (for version 2.3.0, 2.6.0 or 2.6.1):
|
Version Used:
fxcop 2.6.0-beta1-62231-02
Steps to Reproduce:
2.6.0-beta1-62205-01 6.42 KB Thu, 05 Oct 2017 03:35:16 GMT 1
2.6.0-beta1-62126-01 6.43 KB Wed, 27 Sep 2017 00:13:07 GMT 1
Expected Behavior:
Build works without errors about loading assemblies.
Actual Behavior:
Get LOTS of these, one for each analyzer.
Warning CS8032 An instance of analyzer Microsoft.CodeQuality.Analyzers.ApiDesignGuidelines.MarkAttributesWithAttributeUsageAnalyzer cannot be created from C:\Users\jhealy.nuget\packages\microsoft.codequality.analyzers\2.6.0-beta1-62231-02\analyzers\dotnet\cs\Microsoft.CodeQuality.Analyzers.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=2.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.. RoslynProofsCore C:\dev\cs\analyzers.git\RoslynProofsCoreSLN\RoslynProofsCore\CSC 1 Active
The text was updated successfully, but these errors were encountered: