2

Recently I updated my Visual Studio 2015 to 2017, then i've tried to migrate all my solutions from VS2015. But after migration, one of my project build failed with below error:

Severity Code
Description  Project File
Line Suppression State
Error The command nuget.exe pack [path] -IncludeReferencedProjects  -OutputDirectory [path]
" exited with code 9009.

In the post-build event, I have added below command:

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

This project was built successfully in Visual Studio 2015, but failed in the Visual Studio 2017.

Any suggestions are grateful.

2 Answers2

3

Visual Studio 2017 - Post build exited with code 9009

According to the error message, there should be some mistakes in your command line. So you should double check your command line in the post-build event. I would like give your some points to check your command:

  1. If you have spaces in your command, you need to use double quotation marks on it.

    nuget.exe pack "$(ProjectPath)" -IncludeReferencedProjects -OutputDirectory "$(SolutionDir)[path]"
    
  2. Since nuget.exe is an external command for windows, we could not call it directly on windows, need to set the path of nuget.exe to the environment variable.

After add nuget.exe to the environment variable, I could execute below command line successfully, you can check it if works for you:

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

enter image description here

Hope this helps.

Leo Liu
  • 71,098
  • 10
  • 114
  • 135
  • @votedown, can not understand the votedown, could please let me know the reason for it? So I can update my answer. Thanks. – Leo Liu Sep 29 '17 at 05:48
  • Do not know the votedown. But the second point help me. Because I save my nuget.exe in the root directory C:\. After update my windows from windows 7 to windows 10 and update VS 2015 to 2017, I forgot to add the path into environment. Thanks for you again! –  Sep 29 '17 at 14:31
  • My problem is that the project wants to run NuGet, but it seems VS 2017 do not have nuget.exe itself. Hence, I download it, and put it under windows folder. https://stackoverflow.com/questions/15097538/nuget-install-exit-code-9009 – cwhsu Feb 19 '19 at 07:30
-1

In Visual Studio :

Select 'module for which getting error' from solution

Explorer > right click properties > Build Events > Post build event command line - Edit Post-build > Remove the command > Build the project 'Ctrl+Shift+B'.

Pradeep
  • 9,667
  • 13
  • 27
  • 34