类型< type>同时存在于"A"和"B"中

编程入门 行业动态 更新时间:2024-10-25 16:28:59
本文介绍了类型< type>同时存在于"A"和"B"中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

现在,我知道这里已经有很多这样的问题,但是翻阅它们之后,我还没有找到能够解决我的特定问题的问题.

Now I know there are a number of these questions already up here, but after flipping through them, I haven't found one that solves my specific problem.

我有一个ASP.NET MVC 4.5项目.我使用了NuGet并将Newtonsoft.Json添加到了项目中.一旦我在代码中使用了它(以驼峰方式进行一些序列化),我的项目就不再正确构建,并出现以下错误:

I have an ASP.NET MVC 4.5 project. I used NuGet and added Newtonsoft.Json to the project. As soon as I used it in my code (to do some serialization in camel-case), my project no longer builds correctly with the following error:

"C:.. \ Microsoft Visual Studio 12.0 \ Blend \ Newtonsoft.Json.dll"和"C:.. \ Visual Studio 2013 \ Projects \ myProject"中都存在类型"Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver" \ packages \ Newtonsoft.Json.6.0.1 \ lib \ net45 \ Newtonsoft.Json.dll'

The type 'Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver' exists in both 'C:..\Microsoft Visual Studio 12.0\Blend\Newtonsoft.Json.dll" and 'C:..\Visual Studio 2013\Projects\myProject\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll'

不幸的是,每个文件都是相同的文件,直到公用密钥,所以我不能使用Web.config中的依赖程序集引用(如在其他地方建议的那样).我宁愿使用通过NuGet检索的dll,以便更轻松地升级到新版本.

Unfortunately, it's the same file down to the public key on each so I can't use the dependency assembly reference in Web.config (as suggested elsewhere). I would prefer to use the dll retrieved via NuGet so upgrades to new versions are easier.

此外,Temporary Internet文件夹中都没有该文件夹,因此我不能简单地删除它并使它工作.

Additionally, neither one is in the Temporary Internet folder, so I can't simply delete that and have it work either.

我该如何指定要使用的特定程序集文件,以便正确构建项目?谢谢!

How can I go about specifying the specific assembly file I want to use so I can build the project correctly? Thanks!

推荐答案

Xaniff,手动打开项目文件并查找Newtonsoft.您很有可能会找到一个项目组,该项目组所引用的版本与您的nuget软件包不匹配.

Xaniff, open your project file manually and look for Newtonsoft. You will more than likely find an item group with a reference to a version that is not matching your nuget package.. In my case I found this:

<ItemGroup> <Reference Include="Newtonsoft.Json"> <HintPath>..\packages\Newtonsoft.Json.5.0.6\lib\net45\Newtonsoft.Json.dll</HintPath> </Reference> </ItemGroup>

我删除了该项目组,关闭了项目文件,重新加载,一切都很好.

I deleted this item group, closed the project file, reloaded, and all was well.

更多推荐

类型&lt; type&gt;同时存在于"A"和"B"中

本文发布于:2023-11-09 06:10:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1571596.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:类型   amp   lt   quot   gt

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!