private static void UninstallService(string[] args) { using (var ti = new TransactedInstaller()) { using (var pi = new ProjectInstaller()) { ti.Installers.Add(pi); ti.Context = new InstallContext("", null); string path = Assembly.GetExecutingAssembly().Location; ti.Context.Parameters["assemblypath"] = path; ti.Uninstall(null); } } }