nuget未在Visual Studio Team Services下下载软件包(visualstudio.com)(自动软件包还原)

Chr*_*lsh 6 visual-studio-2013 nuget-package-restore azure-devops

我真的很疯狂与nuget并在Visual Studio Team Services(visualstudio.com)下构建解决方案.任何帮助都感激不尽.

我有一个包含36个项目的解决方案.许多项目使用相同的5或6个nuget包.我已仔细按照迁移MSBuild集成解决方案的说明使用自动包恢复,因此在我的解决方案文件夹下有一个.nuget文件夹,其中包含唯一的NuGet.Config文件,不再包含Nuget.exe或Nuget.targets文件.所有项目都删除了Nuget.targets行.

我正在使用Visual Studio 2013 Professional(v12 Update 2),并且本地构建的解决方案没有错误或警告.即使在清理并删除packages文件夹之后,它也会下载并构建正常.packages文件夹未在Visual Studio Team Services中签入.

检查构建日志表明:

  1. nuget在Build的开始没有启动,以便检查,下载和解压任何未解析的软件包(它是在从MSBuild-Integrated迁移到自动软件包恢复之前这样做的 - 尽管如此,它无法解决参考)
  2. 我遗留了113个错误,主要是项目无法解析引用.
  3. 与本地构建(和MSBuild集成)不同,Visual Studio Team Services现在甚至不在其构建日志中提及 nuget!

事情开始失败的日志示例(虽然这显然是因为nuget没有介入):

Project "C:\a\src\TFS\RSPlatform\Main\Source\RSPlatform Team Project.sln" (1) is building "C:\a\src\TFS\RSPlatform\Main\Source\Support\A2Refresh\A2Refresh.csproj" (8) on node 1 (default targets).
PrepareForBuild:
  Creating directory "obj\Release\".
ResolveAssemblyReferences:
  Primary reference "Bytescout.Spreadsheet".
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Bytescout.Spreadsheet". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\a\src\TFS\RSPlatform\Main\Source\Support\A2Refresh\A2Refresh.csproj]
          For SearchPath "C:\a\src\TFS\RSPlatform\Main\Source\Support\A2Refresh\FakesAssemblies".
          Considered "C:\a\src\TFS\RSPlatform\Main\Source\Support\A2Refresh\FakesAssemblies\Bytescout.Spreadsheet.winmd", but it didn't exist.
          Considered "C:\a\src\TFS\RSPlatform\Main\Source\Support\A2Refresh\FakesAssemblies\Bytescout.Spreadsheet.dll", but it didn't exist.
          Considered "C:\a\src\TFS\RSPlatform\Main\Source\Support\A2Refresh\FakesAssemblies\Bytescout.Spreadsheet.exe", but it didn't exist.
          For SearchPath "{HintPathFromItem}".
          Considered "..\..\packages\Bytescout.Spreadsheet.2.4.0.1346\lib\net45\Bytescout.Spreadsheet.dll", but it didn't exist.
          For SearchPath "{TargetFrameworkDirectory}".
          Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Bytescout.Spreadsheet.winmd", but it didn't exist.
          Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Bytescout.Spreadsheet.dll", but it didn't exist.
          Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Bytescout.Spreadsheet.exe", but it didn't exist.
          Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Facades\Bytescout.Spreadsheet.winmd", but it didn't exist.
          Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Facades\Bytescout.Spreadsheet.dll", but it didn't exist.
          Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Facades\Bytescout.Spreadsheet.exe", but it didn't exist.
          For SearchPath "{Registry:Software\Microsoft\.NETFramework,v4.5.1,AssemblyFoldersEx}".
          Considered AssemblyFoldersEx locations.
          For SearchPath "{AssemblyFolders}".
Run Code Online (Sandbox Code Playgroud)

任何人都可以建议我如何让Visual Studio Team Services使用nuget?如果自动包恢复建议丢弃,Visual Studio Team Services如何使用NuGet ~/.nuget/NuGet.exe

谢谢,克里斯

Mic*_*son 1

我没有使用过 Visual Studio Team Services,但NuGet 文档声称默认情况下,包还原应该是构建过程的一部分

对于本地 Team Foundation Build 2013 和 Visual Studio Online(以前称为 Team Foundation Service),默认生成过程模板已实现 NuGet 包还原工作流,无需任何特殊配置。以下信息仅适用于 Team Foundation Build 2012 及更早版本,或已自定义并删除了 NuGet Restore 功能的构建流程模板。

如果由于某种原因您的构建过程不包括此步骤(看起来就是这样),您可能需要手动添加它。这篇博文详细介绍了如何通过 Team Services 使用包还原。它使用专用的构建文件和上一个链接中描述的过程。