命令“C:MainSrc.nuget uget.exe restore -SolutionDirectory .."以代码 1 退出 [英] The command "C:MainSrc.nuget uget.exe restore -SolutionDirectory .." exited with code 1

查看:26
本文介绍了命令“C:MainSrc.nuget uget.exe restore -SolutionDirectory .."以代码 1 退出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个多星期以来,我一直在努力让 NuGet 正常工作.我终于让它在本地构建上工作,但不是在 TFS 2013 构建上工作.我把它缩小到在团队构建期间没有发生 NuGet,但是当我添加了

I've been struggling with getting NuGet to work for well over a week now. I finally got it to work on local builds, but not on TFS 2013 builds. I narrowed it down to NuGet not happening during team builds, but then when I added

$(SolutionDir).nuget
uget.exe restore -SolutionDirectory ..

在构建顺序中我的第一个项目的预构建事件中,我收到此错误.如果我从解决方案目录中的命令行执行该命令,它工作正常.它在本地构建良好,但在构建服务器上我收到此代码 1"错误.非常有帮助 Grrrrrr!所以我打开了 TFS 在构建之前获取的源代码,并尝试在构建服务器上进行本地构建,但我得到了同样的错误(即使它在我的本地机器上运行良好).我尝试增加团队构建的详细程度,但这只是显示相同的错误.抱歉 - 我搜索了这个错误并找到了很多回复,但没有任何帮助...

to the pre-build event on my first project in the build order and I get this error. And if I execute that command from the command line in the solution directory it works fine. It builds locally fine, but on the build server I get this "code 1" error. Very helpful Grrrrr! So I opened the source that TFS gets before the build and tried to doing a local build on the builds server and I get the same error (even though it works fine on my local machine). I tried increased verbosity on the team build but that just shows the same error. Sorry - I've googled this error and found many responses, but nothing that has helped...

顺便说一句,当我在解决方案中运行 nuget.exe 版本时,它的版本是 3.4.3.855.

BTW, when I run the version of nuget.exe in the solution it's version 3.4.3.855.

推荐答案

要启用使用 TFS XAML 构建恢复 NuGet 包,请尝试按照以下步骤操作:

To enable restore NuGet package with TFS XAML build, please try to follow below steps:

  1. 在 VS IDE 中,转到 工具 -> 选项 -> NuGet 包管理器 -> 启用允许 NuGet 下载丢失的包.
  2. 删除 .nuget 文件夹中的 NuGet.exe 和 NuGet.targets 文件.确保这两个文件也从版本控制中删除.
  3. 从 .proj 文件中删除以下标签:
  1. In VS IDE, go to Tools -> Options -> NuGet Package Manager -> enable Allow NuGet to download missing packages.
  2. Delete NuGet.exe and NuGet.targets files from .nuget folder. Be sure these two files are deleted from version control as well.
  3. Remove the following tags from .proj file:

    1. <RestorePackages>true</RestorePackages>

    2.<Import Project="$(SolutionDir).nuget
uget.targets" />  

    3. <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">  
        <PropertyGroup>
            <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, 
    see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
        </PropertyGroup>
        <Error Condition="!Exists('$(SolutionDir).nugetNuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir).nugetNuGet.targets'))" />
    </Target>

更多细节请参考这个分步教程:使用 TFS 自动恢复 Nuget 包构建正确的方式

More details please refer this step by step tutorial:Auto restore Nuget packages with TFS Build the right way

这篇关于命令“C:MainSrc.nuget uget.exe restore -SolutionDirectory .."以代码 1 退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆