1

I have been working with Visual Studio pre build events and I find the error codes rather unhelpful

for example, adding a pre-build event like this:

$(ProjectPath)\DoStuff.exe

This gives me an error: exited with code 267

Or adding like this:

$(ProjectDir)\DoStuff.exe

This gives me an error: exited with code 9009

After a bit of poking about it's possible to figure out what needs to be changed to get the command line to work, but it would probably be far simpler if I could look up the error code and see what it meant.

I have tried google with some of these error codes but some are really hard to find any information about - for example 267 seems rather elusive.

Is there a list somewhere that defines all these error codes?

:)

Pete McPhearson
  • 469
  • 1
  • 7
  • 17

1 Answers1

1

Avoid shooting the messenger. Talk to the owner of DoStuff.exe and ask what these process exit codes mean.

If you have reason to believe that DoStuff is buggy and doesn't set the exit code properly then you can work around it by resetting the %errorlevel% value. Make it look like this:

dostuff.exe
cmd /c ""

The error codes you see could be Windows error codes as declared in the SDK's WinError.h file. Error 267 is ERROR_DIRECTORY, "The directory name is invalid". Error 9009 is DNS_ERROR_RCODE_NOTAUTH, "DNS server not authoritative for zone".

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • Hi - thanks for your reply :) My Investigation reveals that the errors are nothing to do with the exe or bat file I'm attempting to call - in both cases the error is that the path to the DoStuff.exe comes out incorrect. using $(ProjectPath)\DoStuff.exe will result in: c:\myfolder\myProject.projDostuff.exe while the second fails if there is a space in the path. Neither of these return codes can come from the DoStuff.exe as this is never located. (This can be tested by removing the DoStuff.exe from the folder; the same error is returned) – Pete McPhearson Jun 30 '11 at 13:40
  • Yes, it should be $(ProjectDir), not sure how the \ before DoStuff.exe could disappear or why the extension is .proj. A path that has embedded spaces needs to be enclosed by double quotes, "$(ProjectDir)DoStuff.exe" (no backslash necessary). – Hans Passant Jun 30 '11 at 16:14
  • Ah - maybe the \ before dostuff didn't disapear - that might be me making a typo in the re-telling! I'd looked up the windows error code and found 9009 and I'd assumed I'd got the wrong thing, because DNS error doesn't seem to be anything to do with the situation at hand. The 267 code does seem sensible. [MS doc on WinError.h](http://msdn.microsoft.com/en-us/library/ms819773.aspx) Any ideas why this command should result in a DNS_ERROR_RCODE_NOTAUTH error? – Pete McPhearson Jul 02 '11 at 17:51