Freigeben über


cleaning up older .net beta framework installations

I’ve been working with Visual Studio 2010 betas for a while now (it’s really great) and have gone through multiple upgrades of VS and the .Net runtime over the past few months.

While working on a WCF REST service this week I started seeing assembly load errors when IIS was attempting to initialize my service code. The errors in the Event Log looked something like this: “The worker process failed to pre-load .Net Runtime version v4.0.20521.” That seemed a little odd since I’m running version 4.0.21006. 

I double checked that IIS was configured to use v.0.21006 for the Application Pool I was using. It was. Binging around didn’t lead to any quick answers so I’m posting this in hopes that it will now.

Turns out that when you uninstall previous beta versions of VS or the .Net runtime some vestiges remain on your system. In my case %SystemRoot%\Microsoft.Net\Framework and %SystemRoot%\Microsoft.Net\Framework64 contained several v4.0.* subdirectories. IIS appears to have been picking the first subdirectory that matches the major.minor version and attempting to load the runtime from that location. 

Removing the older v4.0 subdirectories (NOT v4.0.21006) cleared up the problem.

Hope that helps someone else.