"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?"的解决方法

#事故现场:

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

1 private static void Main(string[] args)
2 {
3     dynamic obj;
4     obj = new { name = "jack" };
5     Console.WriteLine(obj.name);
6 }

  在读取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的引用;

#参考:

https://stackoverflow.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

时间: 2025-01-17 07:08:28

"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?"的解决方法的相关文章

One or more types required to compile a dynamic expression cannot be found.

This is because dynamic keyword is a new C# keyword. So we need to import Microsoft.CSharp.dll. Here is offical document: http://msdn.microsoft.com/en-us/library/dd264736.aspx  the very first sentence: " Visual C# 2010 introduces a new type, dynamic.

'dataSource' or 'jdbcTemplate' is required 通过注解的解决方法

本人由于需要大量用到复杂SQL进行查询统计,JPA标准方式不满足情况,需要用到Dao,初易用遇到了大家常见的: 'dataSource' or 'jdbcTemplate' is required, 在网上找了很多解决方式都是通过XML方式增加配置解决,有工程了全部采用注解,尽量不引入XML配置,这里查阅相关资料给出一种通过注解方式解决的方案 @Repository public class CollectionCarDaoImpl extends JdbcDaoSupport implemen

error: two or more data types in declaration specifiers原因及解决方法

编译时报错: [plain] view plaincopyprint? error: <strong>two or more data types in declaration specifiers</strong> error: two or more data types in declaration specifiers 原因可能有两个: 1. 少了一个分号";",比如定义一个结构体时,在最后忘了加分号. 解决方法:加上分号即可. 2. 重复定义,比如:a

problem中Project&#39;XX&#39;is missing required library:&#39;[路径]\XXX.jar&#39;解决方法

起因: 今天在接手同事做的一个项目时,发现用Myeclipse部署后,项目里有不少网页出现红叉,逐个修改完后,项目理应不再显示红叉,但奇怪的是,项目所有的子文件都没错误,项目根目录却有个红叉...>_<!同时Myeclipse下的problem中出现一堆error,提示:Project ‘XXX’ is missing required library:'[path] \ XXX.jar'. 解决: 出现这种情况的原因是:在你项目的build path Library中存在重复并且冲突或者地址

安装Scrapy报错 error: Microsoft Visual C++ 14.0 is required解决方法

[问题背景]:在Windows 10系统,pip install Scrapy,报错error: Microsoft Visual C++ 14.0 is required,还有提示Twisted需要安装. [解决方法步骤] 1.根据提示,去https://landinghub.visualstudio.com/visual-cpp-build-tools下载C++编译工具.但是,页面已经打不开,无法下载.  2.之前因需要安装uwsgi,在Windows 10 安装过MinGW,通过可以Min

mybatis报错invalid types () or values ()解决方法

### Cause: org.apache.ibatis.reflection.ReflectionException: Error instantiating class com.chry.browserServer.db.model.User with invalid types () or values (). ause: java.lang.NoSuchMethodException: com.chry.browserServer.db.model.User.<init>()] wit

Eclipse is running in a JRE, but a JDK is required 解决方法

本文非原创,转自http://liguoliang.com/2010/eclipse-is-running-in-a-jre-but-a-jdk-is-required/ 安装Maven后每次启动出现警告信息: Eclipse is running in a JRE, but a JDK is required Some Maven plugins may not work when importing projects or updating source folders. 分两步解决问题:

Redis (error) NOAUTH Authentication required.解决方法

出现认证问题,应该是设置了认证密码,输入密码既可以啦 注意密码是字符串形式! [plain] view plain copy 127.0.0.1:6379> auth "yourpassword" 例如密码是'root',当出现认证问题时候,输入"auth 'root'"即可 [plain] view plain copy 127.0.0.1:6379> set name "hello" (error) NOAUTH Authenti

Array types are now written with the brackets around the element type问题的解决方法

在xcode6.1中来编写swift空数组时,出现的的这个问题,按照官方 Swift 教程<The Swift Programming Language>来写 let emptyArray = String[]() 时会提示"Array types are now written with the brackets around the element type"错误,正确的写法应该是 let emptyArray = [String]() 其它类型类似来处理即可