Reputation: 17540
I have a project that was originally developed using Visual Studio 2010 with .Net 4.0. It is a class library that implements a custom MVC 3 controller and it uses a dynamic type. If I open the project in Visual Studio 2012 RTM, without making any changes to the project, I get the following error on the dynamic types:
One or more types required to compile a dynamic expression cannot be found. Are you missing a reference?
I am also getting another error, which is:
Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.Binder.InvokeMember'
They seem to be related issues. I am not sure why Visual Studio 2012 is confused. The Microsoft.CSharp assembly is in the references. If I open the project again in Visual Studio 2010 it compiles just fine. Has anyone come across this issue and know a solution to it?
Upvotes: 2
Views: 1059
Reputation: 8651
In my case reference to Microsoft.CSharp assembly was missing. I got this error when trying to use JSON.NET, dynamic types and Visual Studio 2012.
Upvotes: 2
Reputation: 17540
The answer turned out to be in a warning that was present when compiling in either VS 2010 and 2012. The warning was:
The predefined type 'System.Runtime.CompilerServices.CallSite' is defined in multiple assemblies in the global alias; using definition from '..\IronJS.Core.0.2.0.1\lib\net40\Microsoft.Scripting.Core.dll'
The project used IronJS and it had a a copy of Microsoft.Scripting and Microsoft.Dynamic in its package that were being referenced. I removed these references and referenced the versions in the global assemblies and everything works fine. Not sure why VS 2012 had a problem with this when VS 2010 did not. Or why it caused the obscure errors.
Upvotes: 1