What does "exited with code 9009" mean during this build?

Viewed 500473

What does this error message mean? What could I do to correct this issue?

AssemblyInfo.cs exited with code 9009


The problem is probably happening as part of a post-build step in a .NET solution in Visual Studio.

35 Answers

Did you try to give the full path of the command that is running in the pre- or post-build event command?

I was getting the 9009 error due to a xcopy post-build event command in Visual Studio 2008.

The command "xcopy.exe /Y C:\projectpath\project.config C:\compilepath\" exited with code 9009.

But in my case it was also intermittent. That is, the error message persists until a restart of the computer, and disappears after a restart of the computer. It is back after some remotely related issue I am yet to discover.

However, in my case providing the command with its full path solved the issue:

c:\windows\system32\xcopy.exe /Y C:\projectpath\project.config C:\compilepath\ 

Instead of just:

xcopy.exe /Y C:\projectpath\project.config C:\compilepath\

If I do not have the full path, it runs for a while after a restart, and then stops.

Also as mentioned on the comments to this post, if there are spaces in full path, then one needs quotation marks around the command. E.g.

"C:\The folder with spaces\ABCDEF\xcopy.exe" /Y C:\projectpath\project.config C:\compilepath\

Note that this example with regards to spaces is not tested.

It happens when you are missing some environment settings for using Microsoft Visual Studio x86 tools.
Therefore, try adding as a first command in your post-build steps:

For Visual Studio 2010 use:

call "$(DevEnvDir)..\Tools\vsvars32.bat"

As @FlorianKoch mentioned in comments, for VS 2017 use:

call "$(DevEnvDir)..\Tools\VsDevCmd.bat"

It should be placed before any other command.
It will set environment for using Microsoft Visual Studio x86 tools.

Another variant:

today I call python interpreter from cron in win32 and take ExitCode (%ERRORLEVEL%) 9009, because system account used by cron don't have path to Python directory.

I fixed this by simply restarting Visual Studio - I had just run dotnet tool install xxx in a console window and VS hadn't yet picked up the new environment variables and/or path settings that were changed, so a quick restart fixed the issue.

My solution was just simple as: have you tried turning it off and on again? So I restarted the computer and the issue was gone.

Happened with a colleague. If development environment is windows and visual studio project is on C: drive.. Than make sure that visual studio is run with administrator right.. simply right click and 'Run as administrator'. You can also go to the properties of visual studio project -> Advance -> and enable 'Run as administrator'.

I had the same error caused by my post build script and I tried to run the script line by line in the command prompt. Finally I found out the root cause is I did not populate the missing information in the .nuspec file, i.e. replacing all the variables between $ and $ with the actual value, e.g. replacing $author$ with my name

Check the Output tab carefully.

That should reveal the issue reason.

(E.g. in my case it was related to a comment: '#' is not recognized as an internal or external command, operable program or batch file.)

it happen with me when i change properties of App.config to be Copy Always

and fix it by undo all my edits then build to make sure it worked

finally reset it again copy always and build it worked

I actually got this error message when signtool.exe itself could not be found. To fix this I added the folder path to the PATH environment variable and restarted Visual Studio.

Related