且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Team Foundation Service 构建在 NuGet 包还原时失败

更新时间:2023-09-18 20:05:04

解决方案在 link 在错误消息本身中.

The solution to this is specified in link in the error message itself.

这是由于该页面中指定的改进而发生的:

This is happening due to an Improvement as specified in that page:

改进

我们更新了 Microsoft.Bcl.Build 以使用不同的方法.新的版本将使用类似于 NuGet 的条件导入自动导入功能.这将始终允许项目在 Visual Studio 中加载.

We’ve updated Microsoft.Bcl.Build to use a different approach. The new version will use a conditional import similar to what NuGet’s automatic import feature does. This will always allow the project to load in Visual Studio.

不过,Microsoft.Bcl.Build 还会向您的项目添加一个目标,该目标将在构建完成后运行.这个目标检查是否当前构建恢复的包,如果是这样,构建失败可操作的错误消息:

However, Microsoft.Bcl.Build also adds a target to your project that will run after the build is finished. This target checks whether the current build restored packages and if so fail the build with an actionable error message:

第二次构建将修复此错误.请注意,这错误只会在包裹丢失时出现,所以它不像你总是要构建两次.

Building a second time will fix this error. Please note that this error will only appear if packages were missing so it’s not like you always have to build twice.

然后它针对构建服务器/持续集成(CI)的情况指定如下:

Then it specifies as below for the case of build server / continuous integration (CI):

此解决方案不涉及构建服务器/持续集成(CI) 情景.为了在构建服务器,你有两种选择:

This solution doesn’t address build server / continuous integration (CI) scenarios. In order to successfully use package restore on the build server, you have two options:

  1. 签入 .targets 文件.
  2. 在构建项目/解决方案之前显式运行 NuGet 包还原.

所以,我想为了解决您的问题,应该遵循上述两个步骤.

So, I suppose for your issue resolution the above two steps should be followed.