未定义或导入预定义类型microsoft.csharp.runtimebinder
我在我的C#项目中使用了dynamic关键字。 我得到以下错误
无法找到编译动态表达式所需的一种或多种类型。
下面是我的代码,我们正在使用VS 2013和.NET Framework 4.5.1。
dynamic cstmDocProp = (Microsoft.Office.Core.DocumentProperties)mScribeShell.ScribeShell.ActiveWordDoc.CustomDocumentProperties; string s = String.Empty; s = Convert.ToString(cstmDocProp[mConstants.g_sPROPERTY_DOCUMENT_INDEX].Value);
我已经按照其他链接中的建议引用了Microsoft.Chasharp DLL和System.Core DLL。
在引用Microsoft.Csharp DLL后,我收到了另一个错误
未定义或导入预定义类型microsoft.csharp.runtimebinder。
-
右键单击您的项目并选择“添加引用”
-
在“Reference Manager”窗口中选择“Assemblies-> Framework”。
-
添加选择
Microsoft.CSharp.dll
并单击添加。
希望这能解决你的问题。