【问题标题】:TFS Build error using visual studio 2015使用 Visual Studio 2015 的 TFS 构建错误
【发布时间】:2016-04-05 10:52:16
【问题描述】:

我在构建 TFS 时遇到问题,一直以来它都因不同类型的错误而失败,我主要解决了,但仍然有错误,我不确定为什么会出现这些错误以及这些错误将如何解决。很抱歉,我无法更详细地解释。

错误 1

C:\Builds\1\SmallBiz\SmallBiz-Web\Sources\SmallBiz.Web\SmallBiz.Web.csproj (9921):此项目引用了 NuGet 包 这台电脑。启用 NuGet 包还原以下载它们。为了 更多信息,请参阅http://go.microsoft.com/fwlink/?LinkID=322105。 缺少的文件是 ..\.nuget\NuGet.targets。

错误 2

异常消息:MSBuild 错误 1 ​​已结束此构建。你可以找到 上面有关此错误原因的更具体信息 消息。 (类型 BuildProcessTerminateException)异常堆栈跟踪: 在 System.Activity.Statements.Throw.Execute(CodeActivityContext 上下文)在 System.Activity.CodeActivity.InternalExecute(ActivityInstance 实例,ActivityExecutor 执行器,BookmarkManager 书签管理器) 在 System.Activity.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

错误图片

请帮助我或指导我,我错在哪里,我在配置中缺少什么。感谢您宝贵的时间和精力,在此先感谢。

【问题讨论】:

  • 您的 bin 文件夹是否已签入源代码管理?
  • 是的,我已经在源代码管理中添加了 bin 文件夹。
  • @adrian 你不应该,这可能是你的问题的一部分。 Bin 文件夹在每次构建时都会重新构建,它不应该进入源代码管理
  • 我是否需要排除 bin 文件夹然后检查构建?
  • 不太确定...确保您的构建服务器安装了最新的框架版本,构建服务器可以访问互联网以进行 nuget 包恢复,为解决方案启用 nuget 包恢复.在我看来,这些错误与其中一件事有关。

标签: visual-studio msbuild


【解决方案1】:

最后我解决了我的问题,删除了 .csproj 文件中的以下标签或行

  1. 右键项目卸载
  2. 右键项目编辑项目文件并删除以下代码
1. <RestorePackages>true</RestorePackages>

2. <Import Project="$(SolutionDir)\.nuget\nuget.targets" />  

3. <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">  
        <PropertyGroup>
            <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, 
    see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
        </PropertyGroup>
        <Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
    </Target>
  1. 解决方案下从源代码管理中删除 .nuget 文件
  2. 重新加载项目并构建它
  3. 签入更改

【讨论】:

    猜你喜欢
    • 2015-12-29
    • 1970-01-01
    • 1970-01-01
    • 2016-03-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-24
    • 1970-01-01
    相关资源
    最近更新 更多