繁体   English   中英

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

[英]nuget not downloaded packages under Visual Studio Team Services (visualstudio.com) (Automatic Package Restore)

我真的很疯狂与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}".

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

谢谢,克里斯

如果您正在构建Visual Studio Team Services,那么我发现Nuget.exe和Nuget.targets都需要存在,这似乎与通过Google搜索此主题可以找到的所有建议相反。

添加它们使我的Visual Studio Team Services构建工作。

在尝试了很多东西后,我发现我使用了错误的默认模板。

我用的是:

DefaultTemplate.11.1.xaml

我的正确模板是:

TfvcTemplate.12.xaml

当我使用此模板时,构建从nuget恢复并正确完成

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

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM