简体   繁体   English

Visual Studio Online中的自动Nuget软件包还原失败

[英]Automatic Nuget package restore in Visual Studio Online fails

I've verified that it works locally by deleting all of the packages from the packages folder, opening up visual studio and then building my project - all of the packages are downloaded first and then it builds. 我已经通过从packages文件夹中删除所有软件包,打开Visual Studio然后构建我的项目来验证它在本地是否有效-首先下载所有软件包,然后进行构建。

I do not have a .nuget folder and in the visual studio options I've allowed Nuget to download missing packages. 我没有.nuget文件夹,在Visual Studio选项中,我允许Nuget下载缺少的软件包。

When building using TFS I get a ton of errors that I do not get when building locally. 使用TFS进行构建时,会出现很多错误,而在本地构建时不会出现。 I believe this to be related to 我相信这与

Thoughts? 有什么想法吗?

在此处输入图片说明

I had the same problem when building a new project with Visual Studio Online and found this solution : 使用Visual Studio Online构建新项目时,我遇到了同样的问题,并找到了以下解决方案

  1. In VS enable Nuget Package Restore (rt click on solution in solution explorer) 在VS中启用Nuget软件包还原(请在解决方案资源管理器中单击解决方案) 在此处输入图片说明
  2. Remove solution /Packages folder from both local workspace and Visual Studio Online Version control. 从本地工作区 Visual Studio Online版本控件中删除解决方案/ Packages文件夹。 (Thanks Robert) (感谢罗伯特)
  3. Confirm build works locally 确认本地构建工作
  4. Check-in changes: 3 Nuget files & modified .sln and .csproj 签入更改:3个Nuget文件和已修改的.sln和.csproj
  5. trigger build 触发构建

NuGet should restore the local packages when you build and will also restore after VSO build. NuGet应该在构建时还原本地软件包,并且在VSO构建后也将还原。 Version control will not have a packages folder, but the required packages end up on the release server. 版本控制将没有程序包文件夹,但是所需的程序包最终在发行服务器上。 I trigger a release manager with each build and deploy with DSC. 我在每次构建时都触发一个发布管理器,并使用DSC进行部署。

NuGet documentation ( 1 & 2 )doesn't explain how that works and I've had to 'toggle' this on & off once to get builds to work after. NuGet文档( 12 )没有解释它是如何工作的,我不得不一次又一次地“切换”此选项以使构建工作。 I've emailed support@nuget.org to ask for more detail and clearer documentation. 我已发送电子邮件至support@nuget.org,要求提供更多详细信息和更清晰的文档。

You should not have to checkin packages to source control. 您无需检入包即可进行源代码管理。 But you'll need to help MSBuild restoring that. 但是您需要帮助MSBuild还原它。

Check this link: http://docs.nuget.org/docs/reference/package-restore-with-team-build 检查此链接: http : //docs.nuget.org/docs/reference/package-restore-with-team-build

The trick is the MSBuild .proj file you have to create and reference there your solutions. 诀窍是必须创建MSBuild .proj文件并在其中引用您的解决方案。

Nuget 2.7 is required 需要Nuget 2.7

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

相关问题 Visual Studio Online:Nuget包还原失败 - Visual Studio Online: Nuget Package restore fails NuGet软件包还原:Visual Studio Online和POSTSHARP - NuGet Package Restore: Visual Studio Online & POSTSHARP Visual Studio联机生成-nuget恢复在一个代理上有效,在另一个代理上失败 - Visual Studio Online Build - nuget restore works on one agent, fails on another nuget未在Visual Studio Team Services下下载软件包(visualstudio.com)(自动软件包还原) - nuget not downloaded packages under Visual Studio Team Services (visualstudio.com) (Automatic Package Restore) NuGet软件包在内部版本和Visual Studio中还原 - NuGet package restore in builds and Visual Studio Nuget还原程序包开始在Visual Studio Team Services构建中失败 - Nuget restore package started to fail in Visual Studio Team Services build Visual Studio Online生成无法从属项目NuGet引用 - Visual Studio Online Build Fails on Dependent Project NuGet References 将私有Nuget包源添加到Visual Studio Online - Adding private Nuget package feeds to Visual Studio Online 如何使Visual Studio Online上的生成器还原所有NuGet包? - How Do I Make the Builder on Visual Studio Online Restore All NuGet Packages? NuGet 还原任务失败(与 netcoreapp2.2 不兼容),但在 Visual Studio 中有效 - NuGet Restore task fails (not compatible with netcoreapp2.2), but it works in Visual Studio
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM