我正在尝试在面向 .net 标准 1.6 的 C# .net 核心应用程序中使用 dynamic
变量。 (平台?库?框架?元框架?)我第一次在实际应用程序中遇到这个问题,但我已将其减少到最小的再现。
项目.json
{
"version": "1.0.0-*",
"buildOptions": { "emitEntryPoint": true },
"dependencies": { "NETStandard.Library": "1.6.0" },
"frameworks": {
"netstandard1.6": { "imports": "dnxcore50" }
},
"runtimes": { "win10-x64": {} }
}
程序.cs
using System;
public class Program {
public static void Main(string[] args) {
dynamic hello = "hello world";
Console.WriteLine(hello);
}
}
当我尝试构建它时,我在 Console.WriteLine(hello);
上遇到了构建错误。
CS0656 Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create'
是否可以在针对 netstandard 1.6 的应用程序中使用 dynamic
变量?怎么办?
最佳答案
添加System.Dynamic.Runtime和 Microsoft.CSharp作为依赖项。
关于c# - 针对网络标准 1.6 的 .net 核心应用程序中的动态引用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39300787/