Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. BeforeUninstall event + Process problems

BeforeUninstall event + Process problems

Scheduled Pinned Locked Moved C#
helpcsharpcomsysadminquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    spif2001
    wrote on last edited by
    #1

    Hi I'm trying to auto-uninstall a COM service from componentservices with the help of Regsvcs.exe's /u command, but my code doesn't seem to work. I have a deployment project, which in CustomAction/uninstall uses af custom install class to, among other things, unistall the service. I have checked that my assemblypath(see code) is correct. I have tried to run Regsvcs /u from a command prompt, and the result is as expected - the service dissapears from the componentservices. When I use Regsvcs /fc during install via my custom install class it works. The service places itself nicely into componentservices. The only mysterious thing I can observe during the whole uninstallation process is, that the BeforeUninstall event seems to fire very late in the uninstall process. Can anyone tell me, why this code whont delete the service from the componentservices?:confused: private string regsvcsPath = Environment.GetEnvironmentVariable("windir") + @"\Microsoft.NET\Framework\v2.0.50727\regsvcs.exe"; public CustomInstaller() { InitializeComponent(); this.BeforeUninstall += new InstallEventHandler(CustomInstaller_BeforeUninstall); } void CustomInstaller_BeforeUninstall(object sender, InstallEventArgs e) { try { string parameters = @" /u " + this.Context.Parameters["assemblypath"]; ProcessStartInfo psi = new ProcessStartInfo(this.regsvcsPath, parameters); Process.Start(psi); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Uninstall error"); } }

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups