I’m working on a RIA system which has a huge number of static resources.
The legacy system renames static files (with a version number) during the build process and has a process which runs through all the pages (which are stored in a legacy database) and updates the filenames in the links.
Now we’re running alongside this an Asp.Net MVC application. The situation is made more complex by the fact that the 2 systems share static resources.
I’m contemplating putting the version number into the web.config, and then adding a modified version of the code from this article: http://www.codeproject.com/KB/aspnet/autojscssversion.aspx, – then let the legacy process manage the numbering on ALL of the static resources for both systems.
Has anyone come across any better methods for managing this kind of thing?
I’m a little surprised though that it’s all this clunky – are there any better approaches?
A common approach for ensuring browsers download the latest versions of your static files is to tack on a query string to the URL.
For example, your application would request something like
/scripts/common.js?version=4.This would probably reduce the complexity of your build process, because you wouldn’t need to rename any files during the build. Then, you could simply put the build/version number in a config file, and change all the URLs to add the version query string at runtime.