将解决方案从 Visual Studio 2010 移动到 2012 后出现严重错误。构建很好,一切正常 localhost。我有一个需要 .NET 4.5 的新 MVC4 项目,所以我在构建服务器上安装了 4.5 框架。构建很好,但 MSBuild 无法将 DotNetOpenAuth.Core.dll 从其包位置复制到 Bin 目录。问题是,尽管特定项目以 4.0 框架为目标,但我相信 MSBuild 正在检查对 .NET 4.5 框架 System.Net.Http 程序集的依赖关系,作为其 CoreBuild 的一部分。
警告代码="MSB3268" 主要参考\packages\DotNetOpenAuth.Core.4.3.0.13117\lib\net40-full\DotNetOpenAuth.Core.dll" 无法解析,因为它间接依赖于框架程序集“System.Net .Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” 在当前目标框架中无法解决。“.NETFramework,Version=v4.0”。要解决此问题,请删除引用“c :\cc\kazork\code\trunk\src\packages\DotNetOpenAuth.Core.4.3.0.13117\lib\net40-full\DotNetOpenAuth.Core.dll”或将您的应用程序重新定位到包含“System.Net.Http”的框架版本,版本=2.0.0.0,文化=中性,PublicKeyToken=b03f5f7f11d50a3a
这是我的包配置:
<?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>
我引用了 System.Net.Http 并将其复制到 bin 中。有问题的项目针对 4.0 框架。我的版本 System.Net.Http 用于 4.0 框架。