Configuring WSPBuilder settings per Visual Studio project

I have been a big fan of WSPBuilder for a long time, but I must admit I haven’t really been paying a whole attention to the new features as the releases have been coming out, I just kept on using the version I had because it was awesome and did what I needed it to do. I did find my way back to the codeplex site to download it again and I had a read over the newer features when I was there and found out this great little trick that lets you provide configuration options to it on a per VS project basis.

So if you have looked at where the WSPBuilder.exe lives, you will undoubtedly seen WSPBuilder.exe.config, which gave you some control over some of the options you can configure when it runs (and you can also set those options in the command line call to WSPBuilder as well). The cool thing that you can do (apparently since August 30 last year! Seriously I don’t believe I have been missing this for this long) is take a copy of WSPBuilder.exe.config and paste it into your Visual Studio Project directory, make the changes to the config file that should be set for that project, and then whenever you build your WSP file within Visual Studio it will obey the rules of that config file!

This has a few great benefits from my point of view, firstly you can force a project to not include assemblies – an example I had was two projects in a solution, each generated a WSP file but only 1 had a DLL in it, I could have set the configuration for that one to exclude assemblies to ensure that no matter what was built (eg someone in the team accidentally building the empty assembly)  the output will never have a WSP file. The second win relates to that, in that you can create the required configuration file and check it in to source control – this means that your team will always be building the WSP file with exactly the same settings and those settings are completely versioned! Very, very cool stuff in my opinion.

So now that I know this, my next step will be to make sure that this integration works when you have TFS build your WSP file for you (and lucky for me I should be setting up a new TFS environment for a client next week sometime so I can configure it there!). No doubt I will blog about that when it happens as well, so stay tuned for that.

In all seriousness though, WSPBuilder just continues to amaze me with what it does – Carsten Keutmann is a genius for bringing this project to life! As always you can get the latest version of WSPBuilder from http://wspbuilder.codeplex.com/ and you can read Carsten’s blog at http://keutmann.blogspot.com/.