C# – 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

cnet

I am trying to compile this code in Microsoft Visual C# 2010

using System;
using System.Globalization;


class main
{
    static void Main()
    {

        dynamic d;
        d = "dyna";
        Console.WriteLine(d);    
    }
}

but I am getting these two errors

Error 1 Predefined type 'Microsoft.CSharp.RuntimeBinder.Binder' is not defined or imported

Error 2 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 read this other post but I am new to C# and I couldn't understand what really is the problem. Especially what and where are these so called .config files..

Best Answer

On your solution explorer window, right click to References, select Add Reference, go to .NET tab, find and add Microsoft.CSharp.

Alternatively add the Microsoft.CSharp NuGet package.

Install-Package Microsoft.CSharp
Related Topic