3

this problem's been driving me mad for a while now, I'm making use of the dynamic type in part of my library (targeting .NET Standard 1.2 & 2.0 + .NET Framework 3.5). I've added a reference to Microsoft.CSharp which has added correctly to the .NET Standard versions of my project (Microsoft.CSharp & System.Runtime.Binding in v1.2, Microsoft.CSharp in v2.0).

From browsing the web, it seems like this should be enough to get things working, but I keep getting the error:

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

in the .NET Standard 2.0 build.

I've tried numerous project cleans & rebuilds, using various different versions of Microsoft.CSharp, manually added System.Runtime.Binding into v2.0, whatever I try it still keeps coming up with the same error. Does anyone have any further suggestions of things to try?

Kind regards James

jazb
  • 5,498
  • 6
  • 37
  • 44
JCoyle
  • 100
  • 9

1 Answers1

3

The dynamic keyword was introduced in C# 4.0 which requires .NET Framework 4.0, you're targeting .NET 3.5 therefore the dynamic keyword is not available.

Jelle
  • 104
  • 1
  • 9
  • 1
    Ah, whoops, should have thought to check that. Doesn't help with Visual Studio throwing me a red herring saying the problem's with my standard build though. I'll try updating the framework version to 4.0 and see if it helps. Thank you – JCoyle Oct 26 '18 at 09:21
  • You can actually target version 4.5.1 as .NET Standard 1.2 is compatible with .NET 4.5.1, this will let you make use of C# 5 – Jelle Oct 26 '18 at 09:24
  • I actually deliberately set it to a really old version of .NET framework because I know some users are stuck on framework 4.0, targeting 3.5 was just to cast the net extra wide in what I support. For my own understanding, if I'm already targeting .NET Standard 1.2, is there any benefit to also targeting 4.5.1? Wouldn't I already be targeting it implicitly by the fact I'm targeting the corresponding .NET standard version? – JCoyle Oct 26 '18 at 10:48