Friday, December 21, 2007

Another way to ruin your deadlines...

...found on the web (thanks for the net-crack Jeffrey!)

It took me a while to get to level 48 and I'm sure I'll be playing this for another 30 minutes sadly. I'll be visiting this page a bunch.

If you're building a C# webservice...

...and you've given your service an auto-installer you may run into the problem I ran into today. Hopefully I can save you the immense frustration I experienced by leaving this tip for you.

When you build your service and see something like:

Microsoft.Common.targets(3090,13): error MSB3073: The command "c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\installutil.exe -u "C:\Users\hans\Desktop\Process Manager\Process Manager.exe" "C:\Windows\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(3090,13): error MSB3073: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\installutil.exe "C:\Users\hans\Desktop\Process Manager\Process Manager.exe"" exited with code -1.

Don't bother googling, don't bother reading Microsoft's support site(s), don't bother combing enwsgroups. Just make sure you don't have a process instance of your service running in the background, then open a command prompt (as Administrator) and use the SC.exe utility to delete your service from the services list. If you get 'Access Denied' ensure, again, that you don't have a process instance of your service running. You will likely get past the 'Access Denied' and either get a success message or a message saying the service is not registered so it could not be deleted. Either way you're fixed now. Try rebuilding your service again. This most often arises if you're using the 'Debug version of service run as normal application instead of service' debugging trick.

This was driving me crazy earlier this week and I don't want to try to remember it in 12 months when it happens to me again...

P.S. 'Access Denied' reported by SC.exe after you've killed any errant process instances usually means that the Services.msc component (the services applet) is open and was hung trying to start it. Just close the applet and try the "SC.exe delete "" command again and you'll be golden.