Weird .NET Assembly warnings when building my .NET web application
Asked Answered
B

0

7

When I build my ASP.NET web application I'm seeing the following weird warnings in my build output.

1>------ Build started: Project: Hornet.Api, Configuration: Debug Any CPU ------
1>  No way to resolve conflict between "Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" and "Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed". Choosing "Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" arbitrarily.
1>  No way to resolve conflict between "Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" and "Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed". Choosing "Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" arbitrarily.
1>  Consider app.config remapping of assembly "Newtonsoft.Json, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" from Version "9.0.0.0" [] to Version "10.0.0.0" [C:\Projects\Personal\Hornet\Hornet.Api\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll] to solve conflict and get rid of warning.
1>  Consider app.config remapping of assembly "Microsoft.ApplicationInsights, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "2.2.0.0" [] to Version "2.3.0.0" [C:\Projects\Personal\Hornet\Hornet.Api\packages\Microsoft.ApplicationInsights.2.3.0\lib\net46\Microsoft.ApplicationInsights.dll] to solve conflict and get rid of warning.
1>  Consider app.config remapping of assembly "System.Text.RegularExpressions, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.0.10.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\Facades\System.Text.RegularExpressions.dll] to Version "4.1.0.0" [C:\Projects\Personal\Hornet\Hornet.Api\packages\System.Text.RegularExpressions.4.3.0\lib\net463\System.Text.RegularExpressions.dll] to solve conflict and get rid of warning.
1>  Consider app.config remapping of assembly "System.Net.Http, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.0.0.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\System.Net.Http.dll] to Version "4.1.1.0" [C:\Projects\Personal\Hornet\Hornet.Api\packages\System.Net.Http.4.3.1\lib\net46\System.Net.Http.dll] to solve conflict and get rid of warning.
1>  Consider app.config remapping of assembly "System.Diagnostics.Tracing, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.0.20.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\Facades\System.Diagnostics.Tracing.dll] to Version "4.1.1.0" [C:\Projects\Personal\Hornet\Hornet.Api\packages\System.Diagnostics.Tracing.4.3.0\lib\net462\System.Diagnostics.Tracing.dll] to solve conflict and get rid of warning.
1>  Consider app.config remapping of assembly "System.Reflection, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.0.10.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\Facades\System.Reflection.dll] to Version "4.1.1.0" [C:\Projects\Personal\Hornet\Hornet.Api\packages\System.Reflection.4.3.0\lib\net462\System.Reflection.dll] to solve conflict and get rid of warning.
1>  Consider app.config remapping of assembly "System.Runtime, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.0.20.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\Facades\System.Runtime.dll] to Version "4.1.1.0" [C:\Projects\Personal\Hornet\Hornet.Api\packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll] to solve conflict and get rid of warning.
1>  Consider app.config remapping of assembly "System.IO.Compression, Culture=neutral, PublicKeyToken=b77a5c561934e089" from Version "4.0.0.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\System.IO.Compression.dll] to Version "4.1.2.0" [C:\Projects\Personal\Hornet\Hornet.Api\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll] to solve conflict and get rid of warning.
1>  Consider app.config remapping of assembly "System.Runtime.Extensions, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.0.10.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\Facades\System.Runtime.Extensions.dll] to Version "4.1.1.0" [C:\Projects\Personal\Hornet\Hornet.Api\packages\System.Runtime.Extensions.4.3.0\lib\net462\System.Runtime.Extensions.dll] to solve conflict and get rid of warning.
1>  Consider app.config remapping of assembly "Microsoft.Azure.KeyVault.Core, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "1.0.0.0" [] to Version "2.0.0.0" [C:\Projects\Personal\Hornet\Hornet.Api\packages\Microsoft.Azure.KeyVault.Core.2.0.4\lib\net45\Microsoft.Azure.KeyVault.Core.dll] to solve conflict and get rid of warning.
1>  Consider app.config remapping of assembly "System.Runtime.InteropServices, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.0.20.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\Facades\System.Runtime.InteropServices.dll] to Version "4.1.1.0" [C:\Projects\Personal\Hornet\Hornet.Api\packages\System.Runtime.InteropServices.4.3.0\lib\net463\System.Runtime.InteropServices.dll] to solve conflict and get rid of warning.
1>  Consider app.config remapping of assembly "System.Linq, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.0.0.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\Facades\System.Linq.dll] to Version "4.1.1.0" [C:\Projects\Personal\Hornet\Hornet.Api\packages\System.Linq.4.3.0\lib\net463\System.Linq.dll] to solve conflict and get rid of warning.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1964,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file: <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" /><bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="Microsoft.ApplicationInsights" culture="neutral" publicKeyToken="31bf3856ad364e35" /><bindingRedirect oldVersion="0.0.0.0-2.3.0.0" newVersion="2.3.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Text.RegularExpressions" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Net.Http" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Diagnostics.Tracing" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Reflection" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Runtime" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.IO.Compression" culture="neutral" publicKeyToken="b77a5c561934e089" /><bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Runtime.Extensions" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="Microsoft.Azure.KeyVault.Core" culture="neutral" publicKeyToken="31bf3856ad364e35" /><bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Runtime.InteropServices" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Linq" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" /></dependentAssembly></assemblyBinding>

My solution has two projects:

  • Website (ASP.NET v4.7)
  • Tests (.NET v4.7)

So i'm not sure where these warnings are applying to - which project?

Also, I've checked both the (website proj) web.config and (tests proj) app.config for the AssemblyBindings and they are all pointing to the latest .. like this is in both files:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
      </dependentAssembly>

 .....

So why is the compiler thinking there's a conflict with various versions of Newtonsoft.Json ? I've only installed one version ...

I've also got assemblybindings in place and they all seem to point to the latest version installed, also.

Update

  • This is a snippet of my packages.config

<package id="Newtonsoft.Json" version="10.0.2" targetFramework="net47" />

That's in BOTH projects, btw

and this... enter image description here

Update 2

here's the hintpath which is the same for both projects...

<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
  <HintPath>..\..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>

Update 3

OK - this is interesting.

  • Turn on VERBOSE build info
  • I can now see heaps more data. The first warning is saying that my nuget package Google.Apis.QpxExpress.v1 ends up having a dependency on Google.Apis.Core which has a dependency on Json v 9.0.0.
  • My web.config file HAS the binding redirects! (see above).
Bakehouse answered 25/4, 2017 at 4:2 Comment(6)
So you are sure you have json.net version 10.0.0.0 referenced?Trev
Updated Opening Post.Bakehouse
Can you check the .csproj files to ensure the <HintPath> for those assemblies isn't pointing to a different version?Journalistic
Updated OP again. :)Bakehouse
did any of you find an answer , I have done all those steps. and nothingSplayfoot
Check this link https://mcmap.net/q/224135/-how-can-i-fix-assembly-version-conflicts-with-json-net-after-updating-nuget-package-references-in-a-new-asp-net-mvc-5-projectAnticosti

© 2022 - 2024 — McMap. All rights reserved.