Reputation: 148744
I have build a function:
string removeFile(HttpContext context,HttpRequest r)
{
dynamic d = new ExpandoObject() ;
d.ItemCommand = r["itemId"].ToString();
...
...
int res = new PolicyDal().Admin_Kits_AttachFile(d); //sending here the d.
on the other class/file:
public int Admin_Kits_AttachFile(dynamic d)
{
DbCommand command = _webERPDB.GetStoredProcCommand("Admin_Kits_AttachFile");
_webERPDB.AddInParameter(command, "@ItemCommand", DbType.String, d.ItemCommand);
The following error occurs:
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
I've referenced after finding the DLL in FILE SYSTEM since it was not in the regular add reference menu.
why is that ? why it wont compile ? why they didnt put the dll in the normal add reference menu ? ( I had to find the dll in the file system...)
Upvotes: 1
Views: 1291
Reputation:
This error always happens when you use some feature about dynamic object. Complier will throw error about missing Microsoft.CSharp.dll and System.Core.dll.
The cause of this problem is all dynamic object need to be dynamically generated class at runtime like the following image.
To solve this problem you just add reference to "Microsoft.CSharp.dll" for allowing runtime to dynamic compile dynamic object like the image below.
Upvotes: 3
Reputation: 1039488
This assembly contains the DLR. If you need to use dynamic dispatching in your application it must be referenced. It is added as reference by default when you start a new application in VS 2010 (Console, WinForms, ASP.NET, Class library).
why they didnt put the dll in the normal add reference menu?
Actually they did:
Upvotes: 4