2. Check the Expire Web Content and set a time period well into the future.
3. When refreshing the web page, the server will respond with HTTP 304 forcing the browser to retrieve the file from its cache.
4. As can be seen in FireBug, the Cache-Control header has a max age of 31536000 seconds which equates to 365 days.
The server will always send this HTTP 304 message unless the file changes forcing it to send new content. To help force this we can change the file name based on the latest build using the SVN revision number in the filename. So we have lowered data transfer on content that hasn’t changed, but forced it to be sent when you have made a change to the css or js files. Now to get the SVN revision number in to the file name. 1. Import the MSBuildCommunityTasks targets which can be dowloaded from here.
2. Edit the BeforeBuild target to call out to svn and get the latest revision
3. Set it to update the project AssemblyInfo.cs file for the svn revision.
4. Now edit the AfterBuild target to get the full dll version. You could combine these two steps and just get the version from svn, I am working on one project that updates the AssemblyInfo file and another project that allows manual editing of the file, but needs that version within the file name; so I just combined the two for this post.
5. Use this Info.AssemblyVersion to write out the combined css and js files as described in the last post.
In the next post I will cover doing the same, but for a Mercurial repository.