I'm trying to use a dynamic
variable in a C# .net core app that's targeting .net standard 1.6. (platform? library? framework? meta-framework?) I first encountered this problem in a real application, but I have reduced it to a minimal reproduction.
{ "version": "1.0.0-*", "buildOptions": { "emitEntryPoint": true }, "dependencies": { "NETStandard.Library": "1.6.0" }, "frameworks": { "netstandard1.6": { "imports": "dnxcore50" } }, "runtimes": { "win10-x64": {} } }
using System; public class Program { public static void Main(string[] args) { dynamic hello = "hello world"; Console.WriteLine(hello); } }
When I try to build this, I'm getting a build error on Console.WriteLine(hello);
saying this.
CS0656 Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create'
Is it possible to use dynamic
variables in an application targeting netstandard 1.6? How?
NET Standard 2.0. That means you can reference the logic library not only from a . NET Core app, but also from an app built for . NET Framework or Xamarin.
Yes, you can load . NET Framework assemblies into . NET Core 5 and 6.
To set target . NET runtime version to 6.0, enter <TargetFramework>net6. 0</TargetFramework> version in project's .
Targeting Netstandard 2.0 or lower means you'll be able to run on NET 5/6/7 or NET Framework 4. Targeting Netstandard 2.1 means you'll be requiring installation of NET 5/6/7 to run and only be compatible with NET 5/6/7. If you target NET Framework directly, you are only writing legacy NET windows code.
Add System.Dynamic.Runtime and Microsoft.CSharp as dependencies.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With