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);
            Process.WaitForExit(Timeout);
            ExitCode = Process.ExitCode;
            Process.Close();
            return ExitCode;
        }
        static void Main(string[] args)
        {
            ExecuteCommand(@"sc delete ""bapsi service""", 10000);
            Console.WriteLine("BAPSI Service uninstalled...");
            //Console.ReadKey();
        }

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.. ?

Perhaps ensure the service is stopped first?

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!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.