Since none of you responded to the challenge implied at the end of my last post (the fact that it was made a mere four hours ago
notwithstanding), I have foregone billable work in favour of seeing if I could
do it myself.

When installed (instructions below), this will add a Class Library Wizard template to your C# project templates list. When selected, it brings up a small form asking for the name of the first class, then creates said class in a class library project.

Installation
It's not as smooth as it could be. In order to display a form, I needed to create an assembly that has to be installed in the GAC (or some other location in the Visual Studio folder but I don't remember where). And as far as I can tell, .vsi files won't install things to the GAC.

Here are the steps:

  • Run the .vsi file to install the project template. It won't work until the other file is installed in the GAC. You'll get a warning during the installation that it might not be safe. HEED THAT WARNI--er...I mean, it should be fine.
  • Install Suvius.ClassWizard.dll into the GAC: gacutil -I <path to assembly>

Issues

  • It should complain if you enter a blank class name but I forgot to test
  • Not sure what happens if you enter a name with illegal characters
  • It really should have a cancel button
  • I haven't tested this on a machine that is not my own

I wouldn't mind extending it so that it creates two projects: a class library and a test project. The test project would have a reference to NUnit and Rhino.Mocks and both projects would contain a class with the specified name although in the test project, it would have Test appended to the name. It would also be nice to be able to create the class using the ReSharper template just in case someone has modified it, rather than using a hard-coded, and very spartan, one.

There is much more that could be done and luckily, it ties in with the Tree Surgeon app that Bil Simser was nice enough to let me join so hopefully this little side project won't fall by the wayside as they are prone to do. (That will require CodePlex to fix their little server crash problem but I'm optimistic.)

Source code is available on request for the moment. I'll probably post it in the coming days when I rap about what it was like implementing the IWizard interface to build this sucker.

Suvius.ClassWizard.dll (20 KB)
ClassLibraryWizard.vsi (2.94 KB)