Andrew Stopford's Weblog

poobah

News

Articles

MbUnit Folks

Old Blogs

Using FxCop from VS

I really like the fact you can run FxCop direct from VS in VSTS, I really want that from my plain old VS. While researching I found two ways.

VS external tools

 

You can set up FxCop to run inside of the VS command window, the reporting is not great but you could change the options to report to a file.

 

To run direct in the console window go to tools\External Tools.

Cick Add

 

Title : FxCop

Command : C:\Program Files\Microsoft FxCop 1.35\FxCopCmd.exe

Arguments: /c /f:$(TargetPath)  /s /p:"C:\myproject\test.fxcop"

 

(Where test.fxcop would be the fxcop project you’re working with)

 

Initial directory: C:\Program Files\Microsoft FxCop 1.35

 

Click the “Use Output window”

 

I hacked this up from  http://www.codeproject.com/dotnet/FxCopIntegrateVSNET.asp you can base on your output rather than a fxcop project.

 

The downside of this is that you need to change your fxcop project each time you change your VS solution, you also don't get any links to further info on the error.

 

VS plugin

  

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=529920&SiteID=1

 

I mentioned this to Jamie and I do wonder if this would be nice to go into TD.net. I tried it and it does work quite well, nice inclusions in the error and warning lists, links to further info on errors.  The downside is that you need to hack up your project files, manually uninstall it and rule exclusions don't work.

 

So for the time being stuck between a rock and a hard place with this.

Comments

Jeff Brown said:

The FxCop add-in now lives on Tigris.  I agree there's much to be improved.  I'll be looking into it more this week.  I hope to release a new version soon.

Please let me know if you have any suggestions for improvement.  =)

# July 25, 2006 3:56 PM

Jason Haley said:

# July 25, 2006 11:11 PM

Йордан Димитров said:

C# Best Coding Practices Naming Conventions for UI ControlsStringBuilder vs. String / Fast String Operations...

# August 8, 2006 5:28 AM

Йордан Димитров said:

C# Best Coding Practices Naming Conventions for UI ControlsStringBuilder vs. String / Fast String Operations...

# August 8, 2006 5:30 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)