Visual Studio 2017 - 使用代码9009退出后期构建

时间:2017-09-28 17:23:15

标签: 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 9009.

在构建后的事件中,我添加了以下命令:

nuget.exe pack $(ProjectPath) -IncludeReferencedProjects -OutputDirectory $(SolutionDir)[path]

此项目在Visual Studio 2015中成功构建,但在Visual Studio 2017中失败。

任何建议都很感激。

2 个答案:

答案 0 :(得分:3)

  

Visual Studio 2017 - 使用代码9009退出构建后

根据错误消息,您的命令行中应该存在一些错误。因此,您应该在构建后事件中仔细检查命令行。我想给你一些观点来检查你的命令:

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

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

  3. 将nuget.exe添加到环境变量后,我可以成功执行以下命令行,你可以查看它是否适用于你:

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

    enter image description here

    希望这有帮助。

答案 1 :(得分:0)

在Visual Studio中:

从解决方案中选择“出现错误的模块”

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

相关问题