How can I resolve the error: “The command […] exited with code 1”?

I’ve read around many questions but I’ve not been able to find the right answer for me.

As I try to compile a project in VS2012 I have this result:

The command “….toolsbinnuget pack PackagesLib.Html.nuspec – OutputDirectory ….binZipPackages -NoPackageAnalysis” exited with code 1.

I looked for the line of code in my .csproj file, where the error should be, and there is:

<Exec Command="$(ProjectDir)....toolsbinnuget pack $(ProjectDir)PackagesLib.Html.nuspec -OutputDirectory $(OutputPath)Packages -NoPackageAnalysis" />  

What am I doing wrong?

[EDIT] Launching the Debug of that project and ignoring “building errors”, I have a new alert:

“Visual Studio cannot start debugging because the debug target ‘[project.exe path]’ is missing. Please build the project and retry, or set OutputPath and AssemblyName properties appropriately to point at the correct location for the target assembly.”

Answer

The first step is figuring out what the error actually is. In order to do this expand your MsBuild output to be diagnostic. This will reveal the actual command executed and hopefully the full error message as well

  • Tools -> Options
  • Projects and Solutions -> Build and Run
  • Change “MsBuild project build output verbosity” to “Diagnostic”.

Leave a Reply

Your email address will not be published. Required fields are marked *