Code analysis in VS.NET 2005 and resource files

I just ported the first assembly of RapidDB over to .NET 2.0 in VS.NET 2005, and with gritted teeth hit the Build menu and ran Code Analysis. Having run FxCop on previous .NET 1.1 projects, I was ready for the list of warnings, some of which I really wouldn't agree with, and which I'd have to exclude within the FxCop project file.  No need, the exclusion of messages on specific code blocks is now handled by attributes so you can easily spot what is being skipped right in the source code itself.

In the end the hardest thing was extracting error literal messages into resources files.  Otherwise, not too painful and it did actual spot a couple of real logic errors which had sneaked through. 

As for external resource files, VS.NET 2005 provides the ability to create a strongly typed wrapper for lookup of values.  This is very slick and updates every time you add/remove string resources.  Even better, I found I could copy the .resx and the auto generated class back into VS.NET 2003 for the .NET 1.1 code base, and with very little editing (deleting a few attributes which aren't available, and removing any global:: namespace specifiers in the auto generated code).  It worked just as it did in VS.NET 2005.

It takes me back to the days when I used the NuMega code analysis tools on my VB5 projects.  I can't believe it has taken this long for it to arrive as a built in feature for Visual Studio.

Print | posted on Tuesday, November 29, 2005 3:57 PM

Comments on this post

No comments posted yet.

Your comment:

 (will show your gravatar)