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

查看:221
本文介绍了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文件夹中
  3. 删除 NuGet.exe和NuGet.targets文件.这两个文件也将从版本控制中删除.
  4. 从以下标签:
  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\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>

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

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天全站免登陆