Tuesday, September 13, 2011

.Net IDE Error 9009 on compiling a project with post-build commands

The compile error 9009 may also come in the flavor of error 22 or error 1 on projects with a post-build command.  Sometimes it will even have multiple errors on the same item.  What is happening can be generally found by cutting the post-build command out of the error summary at the bottom of the IDE and pasting it into notepad, removing the prefix and postfix data and then trying it in the command line dos-box.

Generally there are three main things that will mess up post-build commands...
1) bad path
2) a path with a .,:=[ ] in it
3) a path with a space in it

Because DOS 8.3 naming conventions still live under the covers of post-build command execution you can expect to get hamstrung by any of these scenarios.  If you're developing under your personal workspace in windows you likely are being affected by number 3.

There is an easy way to deal with each of the above problems.
1) check your paths by pasting them into a File Explorer window
2) replace any of those characters with an underscore _
3) put your paths (even system named path variables) in double-quotations. "$(MyPath)\bin\debug\" for example.

Friday, March 11, 2011

Installing a .Net app as a service without using installutil

Possibly the easiest way to install a .net service without needing to have installUtil.exe on the server is to open a command prompt as Administrator (right-click the command prompt menu item and pick Run As Admin)

Once your command prompt comes up you can simply enter the following command line editing in your service name and path referencing the following example.  (note the space after the = sign is critical)

sc create MyServiceName binPath= "C:\program files\My Service\MyService.exe"