Tip of the week: Clean those ASP.NET temp files
One of the things that Umbraco 5 plugin developers have been struggling with from day 1 is ASP.NET aggressive caching of their assemblies. As it appears, after you build your plugin code and put the new dll into the plugins folder, many times the new code will not be used. Instead, you get the stale cached version and that's very unproductive.
Shannon did a lot of great research last month focussing on just this problem and I'm happy to see that these problems might become obsolete in one of the upcoming versions of Umbraco 5.
From what I've distilled from his blogpost though, there's a very easy way to forces ASP.NET to clear the cache: touch the global.asax instead of the web.config.
One thing that has bothered me for YEARS now is that I have to go into the web.config, add a space, save, etc. Today I realized that it would be so easy to automate this.
A quick search return a tiny utility called FileTouch that does what it says on the tin: change the modify date (or create date, or access date) of a file.
So I made a tiny little batch file that does just that for me:
That's all! I found the temp folder of the site I'm currently working on, executed the above command line and once I try to access the site again I see everything disappearing from the ASP.NET temp folder quickly and new files being put in that equally fast.
You could also make this an afterbuild event in your project but I don't always want the extra hit (rebuilding the cache takes a little extra time), so I prefer to just have the command line open and executing the batch file whenever I think I'll need it.
Foto courtesy of: http://www.flickr.com/photos/emilyrides/5188289325/