I have written windows application for managing specific win service. it can start, stop install and uninstall. also i have setup project ( in the same solution of course). the problem is that after i uninstall the application (add/remove programs) the service of course remains in the service list, if the user didn't uninstall before removing whole application.
i've written seperate console application

public static int ExecuteCommand(string Command, int Timeout)
            int ExitCode;
            ProcessStartInfo ProcessInfo = new ProcessStartInfo("cmd.exe", "/C " + Command);
            Process Process;
            ProcessInfo.CreateNoWindow = true;
            ProcessInfo.UseShellExecute = true;
            Process = Process.Start(ProcessInfo);
            ExitCode = Process.ExitCode;
            return ExitCode;
        static void Main(string[] args)
            ExecuteCommand(@"sc delete ""bapsi service""", 10000);
            Console.WriteLine("BAPSI Service uninstalled...");

console app works fine, I added all files from release folder to setup file system and placed exe in custom uninstall actions.
However- it doesn't run on uninstall..
is there something else I should do? like adding installer class and some more coding or something.. ?

8 Years
Discussion Span
Last Post by Wiizl

The service definately is stopped and it doesnt work anyway..
But in theory it should be enough to simply add the executable in custom actions?


OK.. adding the project output to custom actions helped.
however i still dont get it why my custom exe didnt run.. never mind.
thanks guys!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.