14

I'm using Visual Studio 2017 RC and started a new ASP.NET Core project targeting the full .NET Framework.

This line of code will not compile.

 dynamic handler = _container.GetService(handlerType);

 if (handler == null) _logger.LogError("Can't find handler to handle " + cmd.GetType().Name);

I get the following error

CS0656  Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create'

After some Googling it looks like this is because I'm missing the Microsoft.CSharp Assembly. There are plenty of people who have stumbled into his issue but not seemingly with .NET Core 1.1.

So I did this Install-Package Microsoft.CSharp and got version 4.3.0. My project still won't build.

If I add an Assembly Reference to Microsoft.CSharp (the GAC'd version) then it Compiles and runs.

Is this a Bug? I would have expected the NuGet package to fix this?

Ties
  • 1,073
  • 1
  • 16
  • 27
SimonGates
  • 5,623
  • 3
  • 35
  • 50
  • 3
    This NuGet package is for targetting .NET Standard. For full framework the GAC'd version should be used. It's ok. But Visual Studio 2017 RC not adding this reference automatically is probably a bug. – Alex Feb 17 '17 at 13:09

2 Answers2

14

Just add the reference of Microsoft.CSharp.dll and your error will be removed.

squareskittles
  • 11,997
  • 7
  • 31
  • 48
Sheriff
  • 426
  • 6
  • 13
4

I faced this problem. I resolved this problem for me. You must install Microsoft.CSharp library to your solution from nuget.

You can use Package Manager Console for install Microsoft.CSharp. For example If you want install Microsoft.CSharp 4.7.0 version, you must run this command on the Package Manager Console:

Install-Package Microsoft.CSharp -Version 4.7.0

Nuget link: Microsoft.CSharp

Ramil Aliyev
  • 2,142
  • 1
  • 15
  • 26