Recently, while I was working on rearranging some source in our source code repository at work, I ran across an interesting error…
“Predefined type ‘Microsoft.CSharp.RuntimeBinder.Binder’ is not defined or imported”
– and -
“One or more types required to compile a dynamic expression cannot be found. Are you missing references to Microsoft.CSharp.dll and System.Core.dll?”
I scratched my head for a little bit and thought, man, that’s quite a bizarre error. So, without further ado, I whipped out trusty google (actually, I used Bing) and searched away. My first hit took me to an article on msdn. My first thought was that I had found a quick solution. Alas, that was not to be the case. The following solutions were provided:
To resolve this problem, follow these steps:
- Make sure that you do not specify the /nostdlib option from the command line compiler.
- Make sure that the project refers to the correct Mscorlib.dll file.
- If steps 1 and 2 do not resolve the error, reinstall the .NET Framework SDK.
Woah!! Hold the phone. I’m certainly not going to reinstall half of my development tools. And I certainly wasn’t running into option 1.
At this point, however, I remembered another stranged error I had encountered just moments before. During this task, I had also upgraded my projects to .NET 4.0. Since I had moved file locations, I was forced to remove and re-add the assembly references for the project once more. In a different project, I had an error indicating that I could not embed an interop assembly. I thought that was odd, as I hadn’t indicated I wanted to embed it. Sure enough, though, the default for Visual Studio 2010 is to set the embedded property of the reference to true.
Remembering this, I looked at the new references I had just added again to the project now in question. As I had thought, I had added an interop assembly…namely Interop.IWshRuntimeLibrary.dll. Changing the property to false fixed my issue. Too bad Microsoft’s article may cause some poor developer to wreak havoc on his development machine for no reason.
Have I mentioned that I really love misleading error messages?
