Jim*_*amb 81 asp.net-mvc json.net nuget visual-studio-2013 asp.net-mvc-5.1
我在VS 2013(Update 1)中创建了一个新的ASP.NET MVC 5 Web项目,然后更新了所有NuGet包.当我构建项目时,我收到以下警告:
警告MSB3243:无法解决"Newtonsoft.Json,Version = 6.0.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed"和"Newtonsoft.Json,Version = 4.5.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed"之间的冲突.
但是,当我检查web.config时,我发现绑定重定向已到位:
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
</dependentAssembly>
Run Code Online (Sandbox Code Playgroud)
这正是警告建议的内容.
我该如何修复此警告?
Jim*_*amb 96
这里我用来修复警告的步骤:
McG*_*Gaz 27
我有这个问题,因为我更新了包,其中包括对Newtonsoft.Json 4.5.6的引用的Microsoft.AspNet.WebApi,我已经安装了版本6.使用版本6并不够聪明.
要解决此问题,在WebApi更新后,我打开了Tools> NuGet Package Manager> Pacakge Manager Console并运行:
Update-Package Newtonsoft.Json
Run Code Online (Sandbox Code Playgroud)
日志显示6.0.x和4.5.6版本都更新到最新版本,一切都很好.
我有一种感觉会再次出现.
小智 19
我发现从项目文件中删除此部分修复了问题.
<ItemGroup>
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
Run Code Online (Sandbox Code Playgroud)
小智 9
如果以上都不起作用,请尝试在web.config或app.config中使用它:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30AD4FE6B2A6AEED" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
Run Code Online (Sandbox Code Playgroud)
小智 7
好的,希望这应该可以解决所有(合理的)程序集引用差异...
麾。
我从Newtonsoft.Json 11.0.1升级到12.0.2。在记事本++中打开项目文件,我发现
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
Run Code Online (Sandbox Code Playgroud)
和
<ItemGroup>
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.11.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
</ItemGroup>
Run Code Online (Sandbox Code Playgroud)
我删除了ItemGroup,其中将引用包装到带有11.0.1版本的提示路径。
这些问题可能会令人沮丧地发现。而且,开发人员通常遵循与以前的项目设置相同的步骤。先前的设置没有遇到问题。无论出于何种原因,项目文件有时都会错误地更新。
我非常希望微软能够从弹出的窗口中解决这些Visual Studio DLL的地狱问题。它发生得太频繁了,并导致进度突然停止,直到修复,这通常是通过反复试验造成的。
| 归档时间: |
|
| 查看次数: |
104748 次 |
| 最近记录: |