关于异常Microsoft.CSharp.RuntimeBinder.RuntimeBinderException

简介:

关于Microsoft.CSharp.RuntimeBinder.RuntimeBinderException的异常一般来自于两种,

第一种:

 

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

 

解决它的办法是,直接在项目引用中添加 Micorsoft.Csharp 就可以了。

第二种:

 

an exception of type 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException'

 

引起这种异常的错误是因为匿名类型是不能跨程序集(assembly)的,第一种解决办法是使用 Expando ,第二个办法是在源程序集的AssemblyInfo.cs中加入:

[assembly: InternalsVisibleTo("NameSpace1.SubNameSpace1")]

使用第二种方法后,匿名类型可以传递到目标程序集。

分类: ASP.NET
 
 
 
本文转自左正博客园博客,原文链接: http://www.cnblogs.com/soundcode/p/6895434.html,如需转载请自行联系原作者
 
相关文章
|
Windows
解决方法:未能加载文件或程序集“Microsoft.Office.Interop.Excel。。
.NET错误提示:未能加载文件或程序集“Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”或它的某一个依赖项。
2189 0
|
5月前
|
Unix Linux C#
使用 ABAP + OLE 消费 Windows DLL 文件里的代码和服务
使用 ABAP + OLE 消费 Windows DLL 文件里的代码和服务
27 0
|
9月前
vb6.0中如何引用Microsoft Excel 16.0 Object Library?
将应用程序中的表格数据导入到Excel的“工具”
|
图形学 Windows
构建项目时发生错误 - 错误:CS0006“... \ Assembly-CSharp-firstpass.dll”找不到
构建项目时发生错误 - 错误:CS0006“... \ Assembly-CSharp-firstpass.dll”找不到 我正在为Hololens建立一个简单的项目。 独特的场景与简单的立方体。 我遵循这个教程做出来: - > https://developer.
3487 0
|
BI C++ Windows
RDLC报表 在WinForm里运行出现 未能加载文件或程序集 Microsoft.ReportViewer.WinForms, Version=11.0.0.0 System.IO.FileNotFoundException
原文:RDLC报表 在WinForm里运行出现 未能加载文件或程序集microsoft.reportviewer.winforms 推荐以下方案二 做一下记录顺便帮助一下遇到问题的朋友。 做RDLC报表在WinForm运行,在VS里面调试引用了“Microsoft.ReportViewer.Common.dll”和“Microsoft.ReportViewer.WinForms.dll”调试运行的时候没有问题。
1622 0
|
Windows BI
未能加载文件或程序集 Microsoft.ReportViewer.Common, Version=11.0.0.0
原文: 未能加载文件或程序集 Microsoft.ReportViewer.Common, Version=11.0.0.0 System.IO.FileNotFoundException: 未能加载文件或程序集“Microsoft.ReportViewer.Common, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91”或它的某一个依赖项。
1498 0