Azure 自动构建失败 [英] Azure automatic build failed

查看:25
本文介绍了Azure 自动构建失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在 visualstudio.com 上创建了项目,并在 azure 上启用了持续构建.我创建了 web api 项目,并创建了一些模型和 api 控制器.然后我将它部署在网上,它很酷很长一段时间.然后我通过 NuGet 更新了所有依赖项.构建在本地运行良好,应用程序也在我的本地机器上运行.然后我检查了 tfs,自动部署开始了,但构建错误.它说:

I have recently created project on visualstudio.com, and enabled continuous build on azure. I created web api project, and created some models and api controllers. Then I deployed it online and it was cool for a good while. Then I updated all dependencies through NuGet. Build went fine on local and also app worked on my local machine. Then I checked in to tfs, and automatic deploying kicked in, with build error. It says:

C:asrcHitchStopApipackagesMicrosoft.Bcl.Build.1.0.6 oolsMicrosoft.Bcl.Build.targets (74):EnsureBindingRedirects"任务无法从程序集 C:asrcHitchStopApipackagesMicrosoft.Bcl.Build.1.0.6 oolsMicrosoft.Bcl.Build.Tasks.dll.无法加载文件或程序集file:///C:asrcHitchStopApipackagesMicrosoft.Bcl.Build.1.0.6 oolsMicrosoft.Bcl.Build.Tasks.dll"或其依赖项之一.该系统找不到指定的文件.确认 <UsingTask>声明是正确的,程序集及其所有依赖项都可用,并且任务包含一个实现 Microsoft.Build.Framework.ITask 的公共类.

在我的本地机器构建上,我收到测试项目的警告

On my local machine build I get warning for Tests project

D:ProgrammingProjectsHitchStopHitchStopApipackagesMicrosoft.Bcl.Build.1.0.6 oolsMicrosoft.Bcl.Build.targets(220,5):警告:项目必须安装nuget包 Microsoft.Bcl.

在本地我使用 .NET 4.5、MVC4、Entity Framework 5.0...

On local I use .NET 4.5, MVC4, Entity framework 5.0...

推荐答案

这有点像一个错误,并且记录在多个地方.Bcl.Build 不是在 TFS 上构建所需的项目,因此您只需告诉 TFS 如果它不存在就不要包含它.为此,请打开您的 .csproj 文件(对于每个引用 Bcl.Build 的项目)并更改以下内容:

This is somewhat of a bug and is logged in several places. Bcl.Build isn't a project required to build on TFS, so you simply need to tell TFS not to include it if it doesn't exist. To do this, open up your .csproj file (for each project that references Bcl.Build) and change the following:

<Import Project="..packagesMicrosoft.Bcl.Build.1.0.6	oolsMicrosoft.Bcl.Build.targets" />

添加条件:

<Import Project="..packagesMicrosoft.Bcl.Build.1.0.6	oolsMicrosoft.Bcl.Build.targets" Condition="Exists('..packagesMicrosoft.Bcl.Build.1.0.6	oolsMicrosoft.Bcl.Build.targets')" />

注意:如果您通过 Nuget 更新 Bcl.Build,它也会更新您的项目文件,并且需要再次执行以下操作.如果您不想在每次更新/有参考时都丢失它,请创建此副本的第二个副本并将其注释掉.

Note: If you update Bcl.Build via Nuget, it will also update your project file and the following will need to be done again. Create a second copy of this and comment it out if you don't want to lose it every update/have a reference.

相关参考文献(同一问题,不同表现形式):

Related References (same issue, different manifestation):

http://social.msdn.microsoft.com/Forums/en-US/TFService/thread/7bd2e96b-552a-4897-881c-4b3682ff835e

https://connect.microsoft.com/VisualStudio/feedback/details/788981/microsoft-bcl-build-targets-causes-project-loading-to-fail

https://nuget.codeplex.com/workitem/3135

更新:微软为此写了一篇官方博客.虽然上述在某些情况下确实有效,但它不是保证.Microsoft 和 NuGet 团队正在共同研究解决方案,但同时提供了 3 个(更好?)解决方法选项:

Update: Microsoft wrote an official blog on this. While the above does work in some situations, its not a guarantee. Microsoft and the NuGet team are working together on a solution, but in the meantime have provided 3 (better?) workaround options:

http://blogs.msdn.com/b/dotnet/archive/2013/06/12/nuget-package-restore-issues.aspx

  1. 停止使用包还原并签入所有包文件
  2. 在构建项目之前显式运行包还原
  3. 签入 .targets 文件

这篇关于Azure 自动构建失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆