将VS 2008项目转换为VS 2010后,出现aspnet_merge错误。

问题描述 投票:1回答: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.54.0),但得到同样的错误。

请让我知道需要为同样的问题做什么。

visual-studio-2010 visual-studio-2008 dll .net-assembly aspnet-merge
1个回答
0
投票

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

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

PM> Install-Package Newtonsoft.Json -Version x.x.x.x
© www.soinside.com 2019 - 2024. All rights reserved.