Introduction
My preferred Visual Studio 2005 environment consists of a set of tools for refactoring, automated testing, and continuous integration. I also have settled into a preferred solution and project configurations which have proved to be useful. The following documents this set-up or environment.
I develop .Net Windows Forms applications using C#. My Visual Studio environment reflects this, you will need some extra tools for testing ASP apps or different tools for other programming languages.
Tools
I use the following Visual Studio add-ins useful:
- ReSharper
- TestDriven or TestMatrix (was TestRunner)
- MSBuild Community Tasks
- FxCop
- Ankh
ReSharper
This tool is a slam dunk in my mind. Just get it and learn to use it. It will pay for itself quickly. This tools will assist with refactoring, searching, and highlights code smells.
TestDriven or TestRunner
These tools both (use one or the other) allow NUnit based test code to be run from within the editor by right clicking on the test case or fixture. Best of all they allow the tests to be run in the debugger so I can single step through the production code.
But, ReSharper provides its own test runner although I have not used it much (habit). One real annoying thing about ReSharper's test runner GUI is that the window does not persist position and size. It always opens with a rather useless small size.
I'm undecided on which is the better options, but I have to have one of these.
FxCop
FxCop is annoying, but in a good way. If you have not used it before you will find it quiet frustrating at first as it finds code smells, but then you have to admit that most of the time it has a good point and every now and then it does hit pay dirt. Worth the annoyance, especially if you are working in a team and add it to your build box's tests.
FxCop is configurable, you can add your own rules via a plug-in architecture. I've not done it yet but I think there is an interface to implement like 'IRule'.
Ankh
Ankh (or AnkhSVN) is a Visual Studio add-in for the Subversion version control system. I use it as it automatically marks new files to be added to the repository on the next commit. This gets rid of the annoying "I broke the build because I did not commit a new file" problem. But, Ankh has its rough edges and I generally use Tortoise for updates and commits.
The one annoying thing about Ankh is that it will not allow you to rename an added file until you have committed the file to the repository. If you, like me, use an external tool like Tortoise you must come back into Visual Studio and update the tree (using the Ankh context menu) before it will allow you to rename the file.
Frameworks
I always use the following frameworks:
- NUnit
- NUnitForms (if any Forms UI involved)
Project Configuration
I have configure my projects within a solutions to:
- Common Bin folder use by all production assemblies.
- Common Bin\Tests folder used by all test code assemblies.
- Treat warnings as errors.
- All automated tests in separate assemblies (not in with production code).
- All unit test assembly projects have same name as the assembly they are testing with a ".Tests" suffix.
- Unit test assembly projects are located in a 'Tests' folder that is a child of the production assembly's folder.
- Production EXE and DLLs naming is <Company>.<Product|Context>.<Context>
- A production project's name in Visual Studio is the same as the EXE/DLL name but without the <Company>.<Product> prefix.
- A test code project's name in Visual Studio is the same as the related production project but with a '.Tests' suffix.
- A production project's default namespace is the same as the EXE/DLL name.
- A test project's default namespace is the related production project's namespace with a '.Tests' suffix.
- The Visual Studio's solution name is <Company>.<Product|Context>.
Links
- Resharper
- NUnit
- NUnitForms
- TestMatrix (was TestRunner)
- FxCop
- Community Tasks
Copyright? Na, I prefer collaboration as collaboration is for the selfish. Copy, but do not forget to paste.