tag net asp asp.net nuget

asp.net - net - razor if



Conflicto de versiĆ³n System.Net.Http que provoca una advertencia de compilaciĆ³n (1)

Puede probar la solución alternativa mencionada en este informe de error de Microsoft Connect .

O puede probar y agregar algo como esto a su Web.config:

<runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" /> <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /> </dependentAssembly> </assemblyBinding> </runtime>

Editar:

Esta es la solución en el error de conexión:

modifique .......: <Reference Include = "System.Net.Http">
para leer ......: <Reference Include = "System.Net.Http, Version = 4.0.0.0">

El paquete nuget Microsoft.Net.Http.2.0.20710.0 me está generando una advertencia de compilación debido a su uso de System.Net.Http, versión = 2.0.0.0, que se está peleando con la versión 4 de otro paquete.

¿Cuál es la mejor manera de evitar esto? ¿El paquete Microsoft.Net.Http.2.0.20710.0 está desactualizado? ¿Debería hacer referencia a System.Net.Http, Version = 4.0.0.0 manualmente en mi proyecto?

La salida de compilación es:

There was a conflict between "System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". "System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was chosen because it was primary and "System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was not. References which depend on "System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [C:/Working/MyProject/packages/Microsoft.Net.Http.2.0.20710.0/lib/net40/System.Net.Http.dll]. C:/Working/MyProject/packages/Microsoft.Net.Http.2.0.20710.0/lib/net40/System.Net.Http.dll Project file item includes which caused reference "C:/Working/MyProject/packages/Microsoft.Net.Http.2.0.20710.0/lib/net40/System.Net.Http.dll". System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL References which depend on "System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [C:/Program Files (x86)/Reference Assemblies/Microsoft/Framework/.NETFramework/v4.5/System.Net.Http.dll]. C:/Working/MyProject/packages/Microsoft.AspNet.WebApi.Core.4.0.20710.0/lib/net40/System.Web.Http.dll Project file item includes which caused reference "C:/Working/MyProject/packages/Microsoft.AspNet.WebApi.Core.4.0.20710.0/lib/net40/System.Web.Http.dll". System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL C:/Working/MyProject/packages/Microsoft.AspNet.WebApi.Client.4.0.20710.0/lib/net40/System.Net.Http.Formatting.dll Project file item includes which caused reference "C:/Working/MyProject/packages/Microsoft.AspNet.WebApi.Client.4.0.20710.0/lib/net40/System.Net.Http.Formatting.dll". System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL C:/Working/MyProject/packages/Microsoft.AspNet.WebApi.WebHost.4.0.20710.0/lib/net40/System.Web.Http.WebHost.dll Project file item includes which caused reference "C:/Working/MyProject/packages/Microsoft.AspNet.WebApi.WebHost.4.0.20710.0/lib/net40/System.Web.Http.WebHost.dll". System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL C:/Windows/Microsoft.NET/Framework/v4.0.30319/Microsoft.Common.targets(1578,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly.