TFS 2013 构建控制器不尊重 NuGet 包还原 [英] TFS 2013 Build Controller Not Respecting NuGet Package Restore

查看:25
本文介绍了TFS 2013 构建控制器不尊重 NuGet 包还原的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们将 VSO 与本地构建控制器一起使用 (TFS 2013).我在 Visual Studio 的选项"菜单中启用了 NuGet 包还原(从使用 .nuget 文件夹的旧的、已弃用的方式迁移).

We are using VSO with an on-prem build controller (TFS 2013). I've enabled NuGet package restore in the Options menu of Visual Studio (migrated away from the old, deprecated way with the .nuget folder).

在 VS 中,恢复包工作正常,但是构建控制器不会恢复 NuGet 包.构建控制器在服务帐户下运行,如果我将 VS(在构建服务器上)作为服务帐户启动并构建我的代码,它确实会恢复包.如何让构建控制器恢复丢失的包?

Inside VS, restoring packages works just fine, however the build controller does not restore NuGet packages. The build controller runs under a service account and if I start VS (on the build server) as the service account and build my code it DOES restore the packages. How can I get the build controller to restore the missing packages?

在我的 TFS 的 BuildProcessTemplate 文件夹中,我没有有一个 TfvcTemplate.12.xaml,我只有 DefaultTemplate.11.1.xaml由于我从未编辑过 xaml 文件,因此我看到 NuGetRestore

In my BuildProcessTemplate folder of TFS, I DO NOT have a TfvcTemplate.12.xaml, I only have DefaultTemplate.11.1.xaml and as I've never edited the xaml file, I see that there is a Toolbox item for NuGetRestore

我不确定如何继续,我有点想知道为什么我没有 TfvcTemplate.12.xaml 模板,但既然我没有,我怎么能让我的构建服务器/控制器恢复 NuGet 包?

I'm unsure as to how to proceed, I'm kind of wondering why I don't have the TfvcTemplate.12.xaml template, but since I don't, how can I get my build server/controller to restore NuGet packages?

我已经编辑了服务帐户的 NuGet.config 文件(位于 AppData 文件夹中)以及位于我的解决方案根目录的 .nuget 文件夹中的 NuGet.config 文件,但是我的构建总是失败因为缺少依赖项(NuGet 包).

I have edited the NuGet.config file for the service account (that lives in the AppData folder) as well as the NuGet.config file that lives in the .nuget folder in the root of my solution, however my builds always fail because of missing dependencies (NuGet packages).

有什么办法可以解决这个问题吗?另外,如何获得 TfvcTemplate.12.xaml 构建模板?

Is there any way to solve this issue? Also, how can I get a TfvcTemplate.12.xaml build template?

推荐答案

要使用 TFS 构建启用还原 NuGet 包,请按照以下步骤操作.检查这个博客 了解详情.

To enable restore NuGet package with TFS build, please follow steps below. Check this blog for the details.

  1. 在 VS IDE 中,转到工具 -> 选项 -> NuGet 包管理器 -> 启用允许 NuGet 下载丢失的包.
  2. 从 .nuget 文件夹中删除 NuGet.exe 和 NuGet.targets 文件.将这两个文件也从版本控制中删除.
  3. 从 .proj 文件中删除以下标签:
  1. In VS IDE, go to Tools -> Options -> NuGet Package Manager -> enable Allow NuGet to download missing packages.
  2. Delete NuGet.exe and NuGet.targets files from .nuget folder. Be these two files are deleted from version control as well.
  3. Remove the following tags from .proj file:

    1. <RestorePackages>true</RestorePackages>

    2.<Import Project="$(SolutionDir).nuget
uget.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).nugetNuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir).nugetNuGet.targets'))" />
    </Target>

关于找不到 TfvcTemplate.12.xaml 流程模板的另一个问题,您可以先在 VSO 中创建一个新的团队项目,下载流程文件并将其签入版本控制.然后编辑构建定义,单击流程"选项卡上的新建"按钮,在版本控制中浏览流程文件.

For your another issue about can't find the TfvcTemplate.12.xaml process template, you can first create a new team project in VSO, download the process file and check it in to Version Control. Then edit the build definition, click the New button on the Process tab, browse the process file in the version control.

这篇关于TFS 2013 构建控制器不尊重 NuGet 包还原的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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