Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Msbuild Visual Studio 2017-生成后退出,代码为9009_Msbuild_Visual Studio 2017 - Fatal编程技术网

Msbuild Visual Studio 2017-生成后退出,代码为9009

Msbuild Visual Studio 2017-生成后退出,代码为9009,msbuild,visual-studio-2017,Msbuild,Visual Studio 2017,最近我将Visual Studio 2015更新到2017年,然后我尝试从VS2015迁移所有解决方案。但迁移后,我的一个项目生成失败,错误如下: Severity Code Description Project File Line Suppression State Error The command nuget.exe pack [path] -IncludeReferencedProjects -OutputDirectory [path] " exited with code 90

最近我将Visual Studio 2015更新到2017年,然后我尝试从VS2015迁移所有解决方案。但迁移后,我的一个项目生成失败,错误如下:

Severity Code
Description  Project File
Line Suppression State
Error The command nuget.exe pack [path] -IncludeReferencedProjects  -OutputDirectory [path]
" exited with code 9009.
在生成后事件中,我添加了以下命令:

nuget.exe pack $(ProjectPath) -IncludeReferencedProjects -OutputDirectory $(SolutionDir)[path]
该项目在Visual Studio 2015中成功构建,但在Visual Studio 2017中失败

任何建议都将不胜感激

Visual Studio 2017-生成后退出,代码为9009

根据错误消息,您的命令行中应该有一些错误。因此,您应该在后期生成事件中仔细检查您的命令行。我想给你一些要点来检查你的命令:

  • 如果命令中有空格,则需要在其上使用双引号

    nuget.exe pack "$(ProjectPath)" -IncludeReferencedProjects -OutputDirectory "$(SolutionDir)[path]"
    
  • 由于
    nuget.exe
    是windows的外部命令,我们无法在windows上直接调用它,需要将
    nuget.exe
    的路径设置为环境变量

  • 将nuget.exe添加到环境变量后,我可以成功执行下面的命令行,您可以检查它是否适用于您:

    nuget.exe pack "$(ProjectPath)" -IncludeReferencedProjects -OutputDirectory "$(SolutionDir)Test"
    

    希望这有帮助。

    在Visual Studio中:

    从解决方案中选择“获取错误的模块”


    资源管理器>右键单击属性>生成事件>生成后事件命令行-编辑生成后>删除命令>生成项目“Ctrl+Shift+B”。

    @votedown,无法理解votedown,请告诉我原因?所以我可以更新我的答案。谢谢。我不知道沃德敦。但是第二点帮助我。因为我将我的nuget.exe保存在根目录C:\。在将我的windows从windows 7更新到windows 10并将VS 2015更新到2017之后,我忘记了将路径添加到环境中。再次感谢你!我的问题是,项目想要运行NuGet,但VS 2017本身似乎没有NuGet.exe。因此,我下载了它,并把它放在windows文件夹下。