Advice for using VS2005, TFS, integrated FxCop & ASP.NET
We are trying to use the VS2005 integrated version of FxCop with Team Foundation Server at the back to enforce check-in policies and we're hitting problems with web developments - we've also adopted the Web Application way of doing web development so we have got project files since the project-less development style was causing us even more problems :(
A couple of examples:
- Errors and warnings with no source location - please see my other posthttp://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=475875&SiteID=1
- Microsoft warnings about the casing of each server side control (CA1709) - we're using the widely accepted notation of btnButton, txtTextBox, etc which appears to be throwing this problem
The general problem is that we want the FxCop rules to be enforced via a check-in policy, but this applies to the whole Team Foundation Server development project so we cannot have different settings for component code and ASP.NET code :(
Is there any general advice out there for running the development set up I've described?
Thanks,
Sara
[1335 byte] By [
Sara_H] at [2007-12-24]
Hi Sara,
Are you using Web Application Projects or are you using the standalone version of FxCop integrated into the VS IDE using a post-build event? From the problems described in 1. it sounds like you're doing the latter. I recommend trying out the new Web Application Projects, as FxCop integration in VS is much better in this way of developing websites: http://msdn.microsoft.com/asp.net/reference/infrastructure/wap/ If this is not an option for you, you can alternatively upgrade to the final version of FxCop 1.35 that changed the way the message for no source location is written out making sure VS doesn't crash.
Regarding point 2. FxCop only reports naming issues on public APIs for public API's. The Microsoft .NET Framework Guidelines explictly say not to use hungarian notation for public APIs (See http://msdn2.microsoft.com/en-us/library/ms229045.aspx). FxCop's rule set is inline with these guidelines. Most often when people have seen lots of naming violations, most of the violations can be resolved by changing the visibility of the API to be internal.
Regards,
Jeffrey
Morning Jeffrey,
We already are using VS2005 with the fully integrated out-of-the-box FxCop backed up with TFS and check-in policies. We are also already using the addin for Web Application projects.
We are *not* having problems with VS crashing but we *are* having many other issues, including the two I've specifically named above.
We are using Hungarian for UI objects (buttons, text boxes, radio buttons, etc) as this still seems to be a widely accepted approach - i.e. we name a button "btnGetClientDetails" rather than just "GetClientDetails" so that in the code behind the developer is aware that the object is a button. There do not seem to be any specific guidelines for UI development from Microsoft, the link you posted above is for "Design Guidelines for Developing Class Libraries". Can you maybe direct me to UI guidelines I've missed?
Working the way we are, a problem arises when the designer code is auto-generated and a "Protected WithEvents" item is automatically declared with a matching name - to allow the code behind to access the UI object.
I hope this helps explain the circumstances a little further,
Sara
Hi Sara,
Sorry for the late reply. Microsoft does not release any .net naming guidelines specific around UI. The general guidelines are that if you make something publicly visible, it should follow the Microsoft Design Guidelines for class libraries (as it can be consumed by other code).
If you want to use hungarian notatian in items that are publicly visible (which you have to do with your WithEvents properties inside asp.net pages to make the code behind work), you will need to turn off the Naming Rules that enforce the pascal casing.
Regards,
Jeffrey
Thanks Jeffrey, I guess that confirms my suspicion. I'll look into switching off the MS rule and writing a custom one to do basically the same check but to allow for our Hungarian on the UI components
Thanks,
Sara
[EDIT]
PS
What about the errors and warning which appear without location information? Is there anything that either I or the developers can do about that issue? I posted an example of what's happening on this thread http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=475875&SiteID=1
Sara,
Can you post a repro project/solution to the email address listed in my profile?
I suspect that it's the ASP.NET generated code when the violation is occuring, hence why there is not location information.
Regards
David