Archive for June, 2008

Updating Your Web.Config From Each Build with CruiseControl

Let’s say you have CruiseControl.NET all set up nice and hunky dory.  Now you love the fact that it labels your each build, and you want to somehow show that from your project.  Here is how you can get your CruiseControl.NET project build number into your Web.Config.  This concept can be applied to update any file.
It’s super easy. You will need to add an exec block to your ccnet.config
<!-- Auto increment web.config build number -->
<executable>E:\Userdata\CruiseControl\Tools\MergeWebConfigValues.exe (my custom tool)</executable>
<buildArgs>"E:\Program Files (x86)\CruiseControl.NET\server\Main.state" e:\userdata\cruisecontrol\Dev_Main\Web.config</buildArgs>
 Now all you need to do is write the MergeWebConfigValues.exe
What does it do?
1. It reads the CCNET state file (provided by argument 1) and grabs the last label from there. (The state file is an XML file)
2. It then goes and writes to your Web.Config and updates the build number in there. (or writes to any specified file you like)
Lastly, update your code to read this value by adding some version or about page to read your Web.Config
You now instantly know what version your code is.

Regular Expression Designer

If you are doing frequent work with regular expressions, check out this free tool – Regular Expression Designer by Rad Tools.  It’s very nice and helps you with debugging those pesky statements with different input.

And just 2 reminders regarding naming of variables:

1. Short acronyms should be uppercase

2. Identifiers should be cased correctly

Hopefully I’ll post some more stuff soon, been busy last week with personal stuff (selling my car, etc.)

Optimization WordPress Plugins & Solutions by W3 EDGE