Wednesday, November 7, 2007

Could not find file 'Microsoft.Windows.CommonLanguageRuntime, Version=2.0.50727.0'


When the compiler cannot find the Common Language Runtime, you can become confused...


I recently made some uncontrolled move with my mouse while holding down its left button over the Solution Explorer in Visual Studio - it sometimes just happens, you know... (too much coffee???)

Anyway - I knew something happened, because noticed that the window blinked and looked like digesting something for a second or two... I tried to find some file moved into some strange folder or something, but could find anything like that - so I just continued to write code.

And then - after a few minutes, when I hit Ctrl+Shift+B - I got this error:

Could not find file 'Microsoft.Windows.CommonLanguageRuntime, Version=2.0.50727.0'

Excuse me? Come again (I hit Ctrl+Shift+B once more)?!?

Yeah, apparently the CLR had been uninstalled - oh, no problem, happens every other day, right?

Seriously - the error did not want to go away, and (of course) it was the worst moment for something like that to appear, so I started googling... and found out, that it actually does happen - well, not the uninstallation of the CLR, but the error message.

The cause of the error message is this:

If I activate the "Enable ClickOnce Security Settings" [in Project Properties] I get the error, if I disable this feature it compiles correctly.

[http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=148745&SiteID=1]

Perfectly reasonable, eh?

Anyway - the real question is now - what kind of crazy jerk must I have done with my mouse to turn that option on???