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

The Run Code Analysis function is missing in Visual Studio 2017 when using new csproj format. #1086

Closed
Portikus opened this issue Apr 6, 2017 · 8 comments
Milestone

Comments

@Portikus
Copy link

Portikus commented Apr 6, 2017

I want to use the Visual Studio Code analyser for my new .netstandard libray project. But when I right click on the project there is no analyse menu item anymore. It seems that all projects which use the new csproj formats cannot be analysed with the analyser.

Is this known?

Update:

If I add the following to the csproj file:

<RunCodeAnalysis>true</RunCodeAnalysis> <CodeAnalysisRuleSet>...</CodeAnalysisRuleSet>

and when I then build the project with MSBuild 15 it will run the code anaysis and generates the following warning:

MSBUILD : warning : CA0068 : Debug information could not be found for target assembly 'CodeAnalyseTest.dll'. For b est analysis results, include the .pdb file with debug information for 'CodeAnalyseTest.dll' in the same directory a s the target assembly.

But the .pdb is there. When I add now a

<DebugType>Full</DebugType>

to the csproj and then rebuild it with msbuild the code analyse works well.
But why is it impossible to do this with Visual Studio?

Update2:
If I add the RunCodeAnalysis tag to the project file then it will run the analysis on each build even in Visual Studio. But this is not what I want. I want to choose when I the analyse has to run.

@dsplaisted
Copy link
Member

@srivatsn @davkean @AnthonyDGreen Do we have guidance on how to set up Roslyn Analyzers to replace code analysis?

@Portikus
Copy link
Author

This would be nice. So is the Visual Studio Code Analysis dead? And we should take Roslyn Analyser instead?

@srivatsn
Copy link
Contributor

The implementation behind VS's CodeAnalysis feature is being replaced. It used to work by doing binary analysis (FxCop) and it is going to be switched to doing source analysis using Roslyn analyzers. So the scenario\experience is not dead - just the old analysis engine which doesn't support netstandard.
@jinujoseph @mavasani

@livarcocc livarcocc added this to the 2.0 milestone Apr 19, 2017
@Portikus
Copy link
Author

So is it possible to run the same analyser rules with Roslyn now? I cannot find any help for doing such thing.
And why do you say

just the old analysis engine which doesn't support netstandard.

it is possible to run the analyser for netstandard libraries as you can see in my first post. It is only the visual studio integration which is missing.

But what about Visual Studio code analyser, does it get updates/fixes or is the focus only by roslyn analyser?

Thank you for your help.

@srivatsn
Copy link
Contributor

So is it possible to run the same analyser rules with Roslyn now? I cannot find any help for doing such thing.

@jinujoseph was talking about writing a doc about that.

it is possible to run the analyser for netstandard libraries as you can see in my first post. It is only the visual studio integration which is missing.

Ah yes for netstandard it might work but I believe it is broken for netcore. Either way it's not tested and

But what about Visual Studio code analyser, does it get updates/fixes or is the focus only by roslyn analyser?

The plan is to update the VS code analysis experience to be powered by Roslyn.

@livarcocc livarcocc modified the milestones: 2.0.0, 2.1.0 May 27, 2017
@livarcocc
Copy link
Contributor

@jinujoseph is this something that you can take over? Thanks!

@jinujoseph
Copy link
Contributor

yes moved over to analyzer repo dotnet/roslyn-analyzers#1310

@jnm2
Copy link

jnm2 commented Oct 5, 2017

I believe Code Metrics has the same issue.

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

6 participants