Jeffrey Palermo (.com)

Sponsors

The Lounge

Wicked Cool Jobs

News

Advertisement

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
Temporarily disable code analysis for single code file with Resharper 3.0.2 and VS 2008

If you hit a code file that's using one of the new funky features of C# 3.0, and Resharper code analysis doesn't recognize it, like property initializers, var, etc, just press the following to disable code analysis for the current code file only:

CTRL+8

Code analysis will turn off, and the red will go away.  Resharper will remember this preference for that code file until you close and reopen Visual Studio.

If you want to turn code analysis back on, just press CTRL+8 again.  You can turn it on and off as much as you like.  I'm finding this especially useful when giving presentations such as the ones at DevTeach.  I want to keep Resharper enabled in order to use all the features, but for some of the code files, I need code analysis turned off.  CTRL+8 allows me to keep the global option on and just turn it off for a single code file.  I love little hidden gems!!


Posted Wed, Nov 28 2007 1:49 AM by Jeffrey Palermo

[Advertisement]

Comments

Dave White wrote re: Temporarily disable code analysis for single code file with Resharper 3.0.2 and VS 2008
on Wed, Nov 28 2007 11:51 AM

This is a great little tidbit of information when you open or step into a really large autogenerated file that normally has lots and lots of things that Resharper doesn't like.

I've asked the Resharper guys if we could get a feature where you could create a "Do Not Analyze" list of files so that Resharper remembers our preferences across sessions.

Cheers,

Dave

Joe Ocampo wrote re: Temporarily disable code analysis for single code file with Resharper 3.0.2 and VS 2008
on Wed, Nov 28 2007 12:28 PM

You made my day!  Thanks!

Eric Hauser’s Blog » Blog Archives » Toggle Resharper code analysis with C# 3.0 wrote Eric Hauser’s Blog » Blog Archives » Toggle Resharper code analysis with C# 3.0
on Thu, Nov 29 2007 10:01 PM

Pingback from  Eric Hauser’s Blog  » Blog Archives   » Toggle Resharper code analysis with C# 3.0

Andrew Siemer wrote re: Temporarily disable code analysis for single code file with Resharper 3.0.2 and VS 2008
on Mon, Jan 7 2008 2:37 PM

Thanks man!  You're a life saver.  I can't wait for the next version of ReSharper so that it works properly with all the new C# widgetry!!!

Jeffrey Palermo wrote re: Temporarily disable code analysis for single code file with Resharper 3.0.2 and VS 2008
on Mon, Jan 7 2008 3:30 PM

@Andrew,

Glad to help.

Devlicio.us