First let me say that I really appreciate all the work done on FxCop. Its a very helpful tool.
However, the integration into VS2005 needs to be back-ported to VS2003. it does not have to be "exactly" like 2005, but it can come close. Here are a few ideas on how this can be accomplished.
1) Provide an AddIn that gives the user a context menu for the projects so code analysis can be run. Sure, you can put it on the "Tools" menu, but that is not as helpful considering most of the other things related to the project are on the context menu. running NUnit and NCover are so much simplier using TestDriven.NET, and I think adding FxCop to that menu would get people to use it more (that is where it is in 2005).
2) The SuppressMessage attribute. I've read all the "we can't use that attribute becuase it's not defined in 1.1" threads. However, I believe there is a compromise that can be made. Allow putting all the "SuppressMessage" attributes in a single file (like you can in 2005) and allow us to pass this file to FxCop. Then FxCop can use this file to figure out what should be suppred and what should not be. The attibutes can be EXACTLY the same ones used in 2005, but is just a "content" file in 2003 and it won't get compiled. then when I compile in 2005, it's ready to go. Just like the projects have an "XML Documentation File" value in the config, you could specify this file as what gets passed to FxCop by the AddIn. Seems pretty simple (I've done it for other AddIn's).
3) Allow the output to be added to the TaskList (or a new Fxcop window) that will allow the user to interact with (just like 2005).
An Addin can be written by anyone (heck, I'd do it), but will do no good without an updated FxCop that can handle the SupressMessage attributes passed as a parameter. Can the FxCop Team give us something like this
Regards,
Roy

FxCop 1.35 and static class methods
thewildkiwi
This works great.. with one minor exception. Your hard coding your assembly outputs to a specific location (bin\debug or bin\release).
I have tried this by added all the known outputs for an assembly to the FxCop project and it does not look like it will output duplicate entires (one for each assembly), but I will have to make sure that it is not using absolute paths becuase different developers may be using different paths when they get the projects from source control.
Roy
TomTogg
Roy,
We have no current plans to make the Code Analysis available with Visual Studio Team System work with Visual Studio 2002/2003.
However, it is possible to still get good support within Visual Studio 2003, including the ability to suppress messages.
To set this up, do the following:
You can now do a couple things within Visual Studio:
To run an analysis:
To suppress messages:
FxCop will now spit violations out to the Output window, double-clicking one of these violations will jump you to the offending line and file within Visual Studio.
This will work in all favours and versions of Visual Studio including Visual Studio 2002/2003/2005 (Standard and Pro) and the Express editions.
bajohnson
Just FYI .. #2 and #16 are now out of sync. You added a $(TargetExt) in with the name of the FxCop configuration.
thinktwice
Why were these two topics combined They are completely seperate issues.
Roy
Nate Hekman
DeFreitasM
I'm not sure I understand what you mean. Which part is hardcoding the assembly location If you mean $(TargetPath), then is controlled by the Output path of the project.
Regards
David
MumbaiKaChela
hi
Can you tell me same steps for VS2005.
How can i integrete my new Rule to it. Do you have any Idea.
I am trying to integrate my Rules in the VS2005.
Please Send me steps how I can add Rules in the VS2005.
Vidhya Sagar
Roy,
This is because FxCop is unable to find the reference to ClassLibrary1.dll. The problem was that I incorrectly assumed that Visual Studio expanded the $(TargetPath) macro into the output file name of the assembly (ie bin\Debug\ClassLibrary2.dll) but instead it expands to the intermediate file name of the assembly (ie obj\Debug\ClassLibrary2.dll), and because of this FxCop was failing to locate ClassLibrary1.dll.
I've updated my instructions (Step 16) that provides a workaround this by passing directories to FxCopCmd where any referenced assemblies can be found (using /d switch).
This is a bit of a hack as it hard codes the bin\Debug and bin\Release folders and may cause FxCop to pick up the wrong references when switching configurations. However, until I can think of a better way of doing this, this will do.
vivekvishist
ClassLibrary1.dll
class1.cs -
using System; namespace ClassLibrary1 { public class Class1 { public static void DoSomething() {} } }ClassLibrary2.dll - (Has a reference to ClassLibrary1.dll)
class1.cs -
using System; namespace ClassLibrary2 { public class Class1 { public Class1() { ClassLibrary1.Class1.DoSomething(); } } }This causes the following output. Any ideas whats up here
LHC
In the .FxCop project
Different target assemblies could be the same "Project1.dll", but have different output paths "/bin/Relase", "/bin/Debug", "/bin/Test".
Your exclusions are now specific to that one target name and not global.
Roy