欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

"One or more types required to compile a dynamic expression cannot be found. ..." 的解决方法

程序员文章站 2024-03-24 18:42:10
...

#事故现场:

  在一个.net 4.0 的项目中使用dynamic,示例代码如下:

private static void Main(string[] args)
{
    dynamic obj;
    obj = new { name = "jack" };
    Console.WriteLine(obj.name);
}

  在读取obj.name时,报错:

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?

#解决方法:

  在项目中,添加Microsoft.CSharp.dll的引用;

"One or more types required to compile a dynamic expression cannot be found. ..." 的解决方法

#参考:

https://*.com/questions/11725514/one-or-more-types-required-to-compile-a-dynamic-expression-cannot-be-found-are

▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼
原文地址:https://www.cnblogs.com/willingtolove/p/10926169.html
▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲