简体   繁体   中英

Predefined type microsoft.csharp.runtimebinder is not defined or imported

I'm using the dynamic keyword in my C# project. I get the below error

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

Below is my code and we are using VS 2013 with .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);

I have already referred Microsoft.Chasharp DLL and System.Core DLL as suggested in other links.

After referring Microsoft.Csharp DLL I'm getting another error as

predefined type microsoft.csharp.runtimebinder is not defined or imported.

  • Right Click on your project and select 'Add reference'

  • Select 'Assemblies->Framework' in 'Reference Manager' window.

  • Add select Microsoft.CSharp.dll and click on add.

Hope this will solve your problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM