NuGet 自动包还原在我的构建服务器上对我不起作用 [英] NuGet auto-package restore just will not work for me on my build server

查看:76
本文介绍了NuGet 自动包还原在我的构建服务器上对我不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里不知所措.我已经尝试了所有我能找到的方法来让 NuGet 在 TFS 构建服务器上恢复我的包,但似乎没有任何效果.(我检查的最新变化是 此处).我已经阅读了很多关于旧版本构建过程模板的问题,所以我只是将构建更改为使用 TfvcTemplate.12.xaml,但仍然没有恢复任何包.这个最新的更改(来自上面的链接)让我删除了 NuGet.targets 文件,现在我收到一条错误消息:

I'm at wits end here. I've tried everything I can find to get NuGet to restore my packages on the TFS build server and nothing seems to work. (The latest changes I checked in I got here). I have read a lot about problems with older versions of the Build Process Template, so I just changed the build to use TfvcTemplate.12.xaml and still no packages are restored. This latest change (from the link above) had me delete the NuGet.targets file and now I get an error saying:

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 
:\Builds\TFS\WebApps\src\WebApps\Main\Src\\.nuget\NuGet.targets.

推荐答案

既然你已经尝试了这么多基于google的解决方案.这可能会使您的环境变得复杂和混乱.

Since you have tried so many solutions based on google. Which may make your environment complex and confusing.

首先,有两种方法可以进行 nuget 还原MSBuild 集成还原Visual Studio 中的自动还原.有完全不同的东西.

First there are two ways to do the nuget restore MSBuild-integrated restore and Automatic restore in Visual Studio. There are totally different things.

使用 NuGet 2.7 及更高版本,Visual Studio 会自动恢复丢失的默认情况下在构建开始时打包.

With NuGet 2.7 and later, Visual Studio automatically restores missing packages by default at the beginning of a build.

由于您使用的是 NuGet 3.4,建议您使用自动还原.

Since you are using NuGet 3.4, suggest you to use Automatic restore.

您只能选择一种方式来执行还原操作.根据您的错误消息 NuGet.targets not found,也许您还没有完成 迁移到自动恢复 步骤.请再做一次或仔细检查.

You could only select one way to do the restore operation. Based your error message NuGet.targets not found, maybe you haven't finished Migrating to automatic restore step. Please do it again or double check this.

您也可以测试迁移,执行以下操作:

You could also test the migration, do the following:

  • 从解决方案中删除包文件夹.
  • 在 Visual Studio 中打开解决方案并开始构建.
  • 自动还原应下载并安装每个依赖项包,而不将它们添加到源代码管理中.

不要将 $(SolutionDir).nuget\nuget.exe restore -SolutionDirectory ..\ 添加到构建顺序中我的第一个项目的预构建事件中.这是进行还原的旧方法.就像在此处描述的方式一样.

Do not add $(SolutionDir).nuget\nuget.exe restore -SolutionDirectory ..\ to the pre-build event on my first project in the build order . This is the old way to do the restore. Just like the way describe here.

Nuget Restore.exe 已添加到 2013 (v12) 模板中.由于您使用的是 TfvcTemplate.12.xaml ,因此您不必再次添加它.

Nuget Restore.exe was added to the 2013 (v12) templates. Since you are using the TfvcTemplate.12.xaml , you don't have to add it again.

非常怀疑您是否将这两种方式混为一谈导致您目前的困境.建议您按照自动还原流程,使用干净的环境,完成迁移到自动还原步骤,在本地测试迁移,确保删除源代码管理中.nuget文件夹中的NuGet.exe和NuGet.targets文件,检查挂起的更改,检查您的 TfvcTemplate.12.xaml 具有 Nuget 还原功能的流程模板.使用旧设置创建新的构建定义并使用模板.最后触发构建...

Highly doubt you were mixing up the two ways cause your present dilemma. Suggest you follow the automatic restore process, use a clean environment, complete migration to automatic restore step , test the migration locally, make sure NuGet.exe and NuGet.targets files from .nuget folder in source control are removed, checking pending changes, check your TfvcTemplate.12.xaml Process Templates with Nuget Restore functionality. Create a new build definition with old settings and use the template. Finally trigger the build...

这篇关于NuGet 自动包还原在我的构建服务器上对我不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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