Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I disable live code analysis in Visual Studio 2017?

Where can I disable live code analysis in Visual Studio 2017? This pops up every time I start my solution. I do not need this:

Live code analysis pop-up picture

I've followed this support document from Microsoft but unchecking "Enable full solution analysis" seems to have no effect on live code analysis. Then I found a solution for Visual Studio 2012 but also without any luck.

So it seems to me that live code analysis is a complete different thing not managed by full solution analysis. It is running immediately as a background process task after (re)starting the solution. Anyway, how can I get rid of this?

like image 548
colidyre Avatar asked Oct 04 '18 14:10

colidyre


People also ask

How do I disable Fxcop?

Right click on your project node in Solution Explorer, choose Properties. There is a Code Analysis tab near the bottom. Click that and uncheck "Enable Code Analysis on Build".

How do I stop auto build in Visual Studio?

You can stop it by changing Options->Projects and Solutions->ASP.NET Core->Auto build and refresh option .

What is Code Analysis in Visual Studio?

The Code Analysis feature of Visual Studio performs static code analysis to help developers identify potential design, globalization, interoperability, performance, security, and a host of other categories of potential problems.

What are Roslyn analyzers?

. NET Compiler Platform (Roslyn) Analyzers inspect your C# or Visual Basic code for style, quality, maintainability, design, and other issues. This inspection or analysis happens during design time in all open files. Analyzers are divided into the following groups: Code style analyzers are built into Visual Studio.


3 Answers

It's not possible In VS2017

only if all Roslyn installed components in Extensions and Updates are disabled.

I'm using a workaround, global setting forces analyses runs at build on solution projects, in editor runs at any change but now editor is a lot faster with bellow workaround:

Tools -> Options -> Text Editor -> C# (in my case) -> Advanced -> Perform editor feature analysis in external process (experimental) -> select it and save.

UPDATE: It's possible in VS2019 16.5

More details on closed issue (solution is for VS2019):How to disable live code compilation/analysis in Visual Studio 2017?

like image 93
SilentTremor Avatar answered Oct 19 '22 06:10

SilentTremor


I had a similar problem. There is this huge temp initialization file in the project, 50K+ lines. Whenever I opened it, Live code analysis would kick in and VS would eat up CPU up to 50%. I was able to turn it off by creating an empty rule set and set it on Code Analysis section of the project's properties. Now It looks like it's running, only for a few seconds and then it stops since there is no rule to apply.

I don't know if this exactly applies to your problem but here how it goes.

To create an empty rule set;

  • Click "Choose multiple rule sets" from the ComboBox under "Run this ruleset" : Choose multiple rule sets

  • Make sure no rule set is checked in the "Add or Remove Ruleset" window.

  • Click "Save As" button: List of Rule Sets
  • In file dialog, save your new rule set. I named mine as "EmptyRuleSet".
  • After saving process, new empty rule set should be selected in the ComboBox. Click the "Open" button below : Open button
  • In rule set details, uncheck all the sub rule sets and there is only "None" under "Action" column: Empty Rule Set Detail
  • Save the changes on project properties. After these steps, you can see that "Live Code Analysis" run empty for a few seconds when you open a file or start the solution, then it stops. You may have to restart the VisualStudio.

Live Code Analysis - empty run

like image 20
AntiqTech Avatar answered Oct 19 '22 07:10

AntiqTech


I was able to make VS 2019 run at acceptable speeds using the 'Auto cancel long running auxiliary operations on typing' setting. The default 'Automatic' setting appeared ineffective, although changing it back now doesn't seen to re-introduce the very slow background processing issue.

enter image description here

I have no idea if this stops/aborts/prevents more useful features, although it seems to "tame" VS 2019's background processing.

like image 2
user2864740 Avatar answered Oct 19 '22 07:10

user2864740