VS2017构建错误-退出nuget restore命令,代码为9009 [英] VS2017 Build error - The command nuget restore exited with code 9009

查看:76
本文介绍了VS2017构建错误-退出nuget restore命令,代码为9009的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在构建项目时,我看到以下错误.

命令" nuget restore ProjectName.csproj-PackagesDirectory.... \ packages退出9009.

当我单击.csproj上的编辑"时,我看到下面的代码行

 <目标名称="BeforeBuild">< Exec WorkingDirectory ="$(ProjDir)"命令=" nuget restore $(ProjectName)-PackageDirectory.. \ .. \ packages></Exec></Target> 

解决方案

首先,您应确保已下载

2),然后打开系统环境变量" PATH ,并在其中配置本地 nuget.exe 的路径.

然后,单击所有确定选项将其保存.

之后,您可以打开 CMD 并键入 nuget 来检查它是否可以调用 nuget.exe

第二,关闭所有vs实例或msbuild窗口,打开项目的 xxx.csproj 文件,

代替,请使用此:

 <目标名称="BeforeBuild">< Exec WorkingDirectory ="$(ProjectDir)"命令="nuget restore $(MSBuildProjectFile)-PackageDirectory .. \ packages"></Exec></Target> 

重新启动项目,或关闭以重新唤醒MSBuild来构建项目.

在我这方面效果很好.

When i am bulding my project i see the below error.

The command "nuget restore ProjectName.csproj - PackagesDirectory ....\packages" exited with 9009.

When i clicked edit on my .csproj i see below lines of code

<Target Name="BeforeBuild">
      <Exec WorkingDirectory ="$(ProjDir)" command = "nuget restore $(ProjectName) -PackagesDirectory
 ..\..\packages>
</Exec>
</Target>

解决方案

First, you should make sure that you have downloaded the latest nuget.exe v5.7.0 and config it full path into System Environment PATH.

1) download it and copy it into a folder

2) then open System Environment Variable PATH and config the path of local nuget.exe into it.

Then, click all Ok option to save it.

After that, you can open CMD and type nuget to check whether it can call nuget.exe.

Second, close all vs instance or msbuild window, open your xxx.csproj file of your project,

Instead, use this:

<Target Name="BeforeBuild">
    <Exec WorkingDirectory="$(ProjectDir)" command = "nuget restore $(MSBuildProjectFile) -PackagesDirectory ..\packages ">
    </Exec>
</Target>

Restart your project, or close to reawaken MSBuild to build your project.

It works well in my side.

这篇关于VS2017构建错误-退出nuget restore命令,代码为9009的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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