Run Setup scripts during installation

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
I want to call some install function during the installation of my application
Can anyone please tell me how to write setup scripts in C# .NET so that
those will run during installation as well as uninstallation
Thanks and Reagrds
 
Here's the short version:
Add a custom installer (Add new item -> Installer class) to your solution.
Override the Install / Uninstall methods in the custom installer and add the
code you want executed to the overrides. Just remember to call base.Install
/ base.Uninstall before you execute your own code.
Open the custom actions tab in your setup project and add the primary output
of the project that contains your installer.
 
Could you send me some help links where I would find some sample codes,or
culd u please show me a sample code.
It would be a great help
Thanks and Regards
 
Here's a sample of how you would override the Install and Uninstall methods
of the base Installer class (when adding a Installer class to a project, it
will by default derive from System.Configuration.Install.Installer).

public override void Install(IDictionary stateSaver)
{
base.Install(stateSaver);
//
// TODO: Add your custom code here
//
}

public override void Uninstall(IDictionary stateSaver)
{
base.Uninstall(stateSaver);
//
// TODO: Add your custom code here
//
}

And of course, a couple of links to further aid your cause:
http://www.c-sharpcorner.com/Code/2003/April/SetupProjects.asp
http://www.codeproject.com/dotnet/CustomizingInstallers.asp
 
Back
Top