I originally wanted to write this post in one, but there is quite a large amount of information which can be broken down into different areas, so I am going to publish it in three posts.
Versioning Combined Files Using Subversion
Versioning Combined Files Using Mercurial – published shortly
There are many ways to improve web site performance, two areas are reducing the amount of data that is served up from the web server and reducing the number of files that are requested.
To edit the project file in Visual Studio, you need to first unload it by right clicking the project in Solution Explorer. I prefer to do this in a third party tool such as Notepad++ and save it there forcing VS to reload it each time I make a change as the whole process in Visual Studio can be a bit tedious.
Now you have the project file, you will notice that it is an MSBuild project file.
1. Import the tasks for AjaxMin choosing the location you installed to. I keep all third party utilities in a Tools directory within my solution structure and source control. This way I know I can get the entire solution from source control without worrying about what other tools I need to get the project to build locally.
2. Now create ItemGroups for all your js and css files like this. Separating out your non minified files and minified files. This can go in the AfterBuild container.
3. Call AjaxMin to do the crunching.
This will create the *.min.css and *.min.js files in the same directory the original files were.
5. Save the project file, if you have Visual Studio open it will ask you to reload the project. You can now run a build and these minified and combined files will be created automatically.
6. Finally reference these minified combined files in your web page.
In the next two posts I will cover versioning these files to match your assembly.