ASP.NET Core 1.1用C#动态编译 缺少编译器所需成员'Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create'。

问题描述 投票:5回答:1

我正在使用Visual Studio 2017 RC,并启动了一个新的ASP.NET Core项目,目标是完整的.NET框架。

这行代码将无法编译。

 dynamic handler = _container.GetService(handlerType);

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

我得到以下错误

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

经过一些Google搜索,看起来这是因为我缺少了Microsoft.CSharp Assembly。有很多人都碰上了他的问题,但似乎不是用.NET Core 1.1。

所以我这样做了 Install-Package Microsoft.CSharp 并得到了4.3.0版本。我的项目仍然不能构建。

如果我给Microsoft.CSharp(GAC'd版本)添加一个汇编参考,那么它就会编译和运行。

这是一个BUG吗?我本以为NuGet包可以解决这个问题?

c# asp.net-core asp.net-core-1.1
1个回答
0
投票

只要添加Microsoft.CSharp.dll的引用,你的错误就会被删除。

© www.soinside.com 2019 - 2024. All rights reserved.