1

我收到一个错误

"aspnet_merge: error 1023: The assemblies cannot be merged because some assemblies have inconsistent attributes: System.Runtime.CompilerServices.ExtensionAttribute. Use -a option to force merge. Use -allowattrs to specify the attributes to skip when checking for consistency."

合并程序集时。

我之前所做的,只需在我的 VS 2010 中打开 VS 2008 解决方案而不更改 .Net Framework(当 VS 2010 提示我将 .Net Framework 更改为 4.0 时选择否)并**missing compiler required member System.Runtime. CompilerServices. ExtensionAttribute..ctor**通过将 NewtonSoft dll 版本从 2.0 更改为 3.5 来解决此错误。

现在成功发布我的项目后,我必须合并 dll,但我遇到了上述错误。我已经检查了不同版本的 aspnet_merge (3.5/4.0),但得到了同样的错误。

请让我知道为此需要做些什么。

4

1 回答 1

0

这是因为该项目没有引用Microsoft.CSharp. 一旦我添加了对该程序集的引用,它就编译得很好。

如果问题仍然存在,请尝试重新安装JSON.Net.

PM> Install-Package Newtonsoft.Json -Version x.x.x.x
于 2020-05-09T19:12:57.323 回答