Got a nasty error after moving a solution from Visual Studio 2010 to 2012. Build is fine and everything works perfect localhost. I have one new MVC4 project that requires .NET 4.5 so I installed the 4.5 framework on the build server. The build is good but MSBuild is failing to copy DotNetOpenAuth.Core.dll from its package location to the Bin dir. The issue is because, though the particular project targets the 4.0 framework, I believe MSBuild is checking the dependency against .NET 4.5 framework System.Net.Http assembly as part of its CoreBuild.
warning code="MSB3268" The primary reference packagesDotNetOpenAuth.Core.4.3.0.13117lib
et40-fullDotNetOpenAuth.Core.dll" could not be resolved because it has an indirect dependency on the framework assembly "System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0". To resolve this problem, either remove the reference "c:cckazorkcoderunksrcpackagesDotNetOpenAuth.Core.4.3.0.13117lib
et40-fullDotNetOpenAuth.Core.dll" or retarget your application to a framework version which contains "System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Here is my package config:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ChardinJs" version="1.0.3" targetFramework="net40" />
<package id="Microsoft.Net.Http" version="2.0.20710.0" targetFramework="net40" />
<package id="DotNetOpenAuth.AspNet" version="4.3.0.13117" targetFramework="net40" />
<package id="DotNetOpenAuth.Core" version="4.3.0.13117" targetFramework="net40" />
<package id="DotNetOpenAuth.OAuth.Consumer" version="4.3.0.13117" targetFramework="net40" />
<package id="DotNetOpenAuth.OAuth.Core" version="4.3.0.13117" targetFramework="net40" />
<package id="DotNetOpenAuth.OpenId.Core" version="4.3.0.13117" targetFramework="net40" />
<package id="DotNetOpenAuth.OpenId.RelyingParty" version="4.3.0.13117" targetFramework="net40" />
<package id="EntityFramework" version="5.0.0" targetFramework="net40" />
<package id="flexigrid" version="1.1.0" targetFramework="net40" />
<package id="jQuery" version="1.9.1" targetFramework="net40" />
<package id="Microsoft.AspNet.FriendlyUrls.Core" version="1.0.0" targetFramework="net40" />
<package id="Microsoft.AspNet.Membership.OpenAuth" version="1.0.1" targetFramework="net40" />
<package id="Microsoft.AspNet.SignalR.Core" version="1.1.1" targetFramework="net40" />
<package id="Microsoft.AspNet.SignalR.JS" version="1.1.1" targetFramework="net40" />
<package id="Microsoft.AspNet.SignalR.Owin" version="1.1.1" targetFramework="net40" />
<package id="Microsoft.AspNet.SignalR.SystemWeb" version="1.1.1" targetFramework="net40" />
<package id="Microsoft.AspNet.Web.Optimization" version="1.0.0" targetFramework="net40" />
<package id="Microsoft.Owin.Host.SystemWeb" version="1.0.1" targetFramework="net40" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net40" />
<package id="Newtonsoft.Json" version="5.0.5" targetFramework="net40" />
<package id="Owin" version="1.0" targetFramework="net40" />
<package id="PayPalCoreSDK" version="1.1.1" targetFramework="net40" />
<package id="PayPalMerchantSDK" version="2.3.98" targetFramework="net40" />
<package id="Select2.js" version="3.3.2" targetFramework="net40" />
<package id="toastr" version="1.2.2" targetFramework="net40" />
<package id="Twitter.Bootstrap" version="2.3.2" targetFramework="net40" />
<package id="WebGrease" version="1.3.0" targetFramework="net40" />
</packages>
I have System.Net.Http referenced and it is copied to the bin. The project in question is targeting the 4.0 framework. My version System.Net.Http is for the 4.0 framework.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…