I want to implement some cache busting code in my library which can be integrated with ASP.NET web applications/sites. This will be implemented through appending a version string to the end of URLs. The default version provider I'd like to provide for cache busting would use the assembly version of the host web site.
Currently, this is essentially how I'm extracting this version number:
HttpContext.Current
.ApplicationInstance
.GetType()
.Assembly
.GetName()
.Version
.ToString()
Unfortunately, at least for my sample test site, Assembly for the application instance is a generated assembly (I guess because the global.asax is compiled into a new assembly). In Get web application assembly name, regardless of current executing assembly, SLaks says you can use BaseType to get the actual site assembly's type, but I assume that if a site doesn't use a global.asax file, BaseType would give you something in the BCL.
Is there any reliable way to extract the assembly version number for an ASP.NET web application? I'm also up for alternative approaches for generating a unique-per-build token that wouldn't require extra build steps for the application developer.