对于CORE包的VSO 2017构建,Nuget还原失败

时间:2017-04-05 12:04:42

标签: asp.net-core nuget visual-studio-2017 azure-pipelines

我之前创建并构建了一个简单的.net核心nuget包并将其推送到我们的内部nuget(托管在我们的VSO中)。现在我想从另一个核心项目中引用它。这在当地运作良好。

然后我去定义我的构建。以下是详细信息:

  • 代理人是“托管VS2017”
  • 过程
    • Nuget Installer(版本3.5,指向我的解决方案文件,nuget.config包含我的包源)
    • 多数民众赞成!我们再也没有了。

当我运行构建时,我在Nuget安装程序位上遇到此错误:

[command]C:\a\_tasks\....\NuGet\3.5.0\NuGet.exe restore -NonInteractive C:\a\1\s\...sln -ConfigFile C:\a\1\s\...\nuget.config
Failed to load msbuild Toolset
Could not load file or assembly 'Microsoft.Build, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. 

我尝试过的事情

  • 如果nuget版本低于3.5,我会获得401未经授权的
  • 如果nuget版本低于3.5且我没有引用dotnetcore nuget,那么
  • 我将自己的凭据添加到nuget.config的packageStoreCredentials部分,但没有效果(我是VSO的管理员)
  • 我尝试使用nuget 4将其exe包含在签入中并引用Nuget安装程序,但我得到“错误:Iac.Repository / nuget.exe失败.poswn Iac.Repository / nuget.exe ENOENT”< / LI>

感谢您的帮助!

2 个答案:

答案 0 :(得分:2)

您需要使用nugget 4.0而不是3.5,因为您的项目基于VS2017。

现在nugget 4.0可用于NuGet Installer任务,因此您可以直接选择版本,无需将版本签入源代码。

enter image description here

对于某些VSTS帐户,不显示nuget 4.0,我创建了a new issue here,您可以跟进。

另一种将nugget 4.0用于TFVC项目的方法:

  1. 在源代码中检查nugget 4.0,例如(10, NULL)
  2. 在获取源步骤中,映射nuget4.0.exe。
  3. enter image description here

    1. 在nugget安装程序任务中,将nugget.exe路径指定为nuget4.0.exe
    2. enter image description here

答案 1 :(得分:1)

我也遇到了这个问题并找到了这个帖子。

在回顾了Marina的评论之后,我能够让它发挥作用。我所做的就是根据评论改变路径。

$(Build.SourcesDirectory)\构建\工具\ nuget.exe

相关问题