Just tried to run an application via the following:
I have browsed to the directory with an app WindowsService1.exe
in it, then tried the command Installutil WindowsService1.exe
but got the following error...
As VS has only been installed for a day or two I'm worried that something may be wrong with that install as it should recognise installutil.
Are there some basic diagnostics I can perform to ensure that VS Command Prompt is finding all the programs that it should ?
EDIT
If i run PATH
in the command prompt I see the following:
This is a tiny bit off-topic but I've stopped using InstallUtil to install my services. It's is really easy to just add it to the service itself. Add a reference to System.Configuration.Install
(not available in the Client Profile editions if I remember right) and then update your Main()-function in Program.cs like this.
static void Main(string[] args) {
if (Environment.UserInteractive) {
var parameter = string.Concat(args);
switch (parameter) {
case "--install":
ManagedInstallerClass.InstallHelper(new[] { Assembly.GetExecutingAssembly().Location });
break;
case "--uninstall":
ManagedInstallerClass.InstallHelper(new[] { "/u", Assembly.GetExecutingAssembly().Location });
break;
}
} else {
ServiceBase[] servicesToRun = {
new Service1()
};
ServiceBase.Run(servicesToRun);
}
}
Then you can just call WindowsService1.exe
with the --install
argument and it will install the service and you can forget about InstallUtil.exe
.