Packer for .NET has been updated to version 4.1. A major new addition is a new MSBuild task called UpdateWebConfig which makes it easier to prepared your web.config file during deployment. There is also the new Combine mode.
Note: Version 4.1.1 has been released with a fix to the targets file.
With this release the Utility class has been renamed FileProcessor. If you are coding against the assembly you will need to change Utility to FileProcessor.
Sometimes you may want to simply combine multiple files together without running the JSMin or CSSMin modes. You may like to spread our CSS across multiple files so they are easier to organize and allow multiple developers to access concurrently. The Combine mode will allow you to combine these files into one either during the build and deployment process or even at runtime if you choose. In the 4.0.3 release I added features to make it possible to push out your files in this way.
I automate as much as I can on a project. One of the most critical changes during deployment is updating the configuration file. To do this I make use of web site projects along with the web deployment project. This process creates a pre-compiled web site which is ready for deployment and while it does have a feature to replace sections of the configuration file, it needs to be more targeted.
A setting that we all have to change is the debug mode which is true during development but should always be false in production. To change this setting with the web deployment projects you must replace the compilation element for that one attribute which means replacing the list of assemblies which are often updated without notice by Visual Studio during development. I find it is dangerous to blindly replace this whole section, so I have been using the XmlUpdate task included with the MSBuild Community Tasks. That task allows you to use an XPath value to target updates to attributes or any node an XPath can reference.
The problem with using XmlUpdate is that it adds a lot to your MSBuild script which is hard to read and maintain. The UpdateWebConfig task allows you to set the values that you would commonly change like the appSettings, debug mode, compilation errors mode, mail host and the configSource value on the connectionStrings element. With a very easy to read MSBuild script I can now set the right values so that when the files are copied to the staging server I can simply click a button in Visual Studio and within minutes (or seconds) the site will be built, configured and copied to the staging server, ready for testing. With the latest site that I am developing this happens in under 20 seconds.
Below is a sample of the new UpdateWebConfig task.