Visual Studio 2017 - Post build exited with code 9009

21,657

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.

Share:
21,657

Related videos on Youtube

Admin
Author by

Admin

Updated on November 29, 2020

Comments

  • Admin
    Admin over 3 years

    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.

  • Leo Liu
    Leo Liu over 6 years
    @votedown, can not understand the votedown, could please let me know the reason for it? So I can update my answer. Thanks.
  • Admin
    Admin over 6 years
    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!
  • cwhsu
    cwhsu about 5 years
    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. stackoverflow.com/questions/15097538/…