Code Snippet
[RunInstaller(true)]
public partial class Installer1 : Installer
{
public Installer1()
{
InitializeComponent();
}
protected override void OnAfterInstall(System.Collections.IDictionary savedState)
{
base.OnAfterInstall(savedState);
string appDirPath = Context.Parameters["PathDir"];
RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);
key.SetValue("MyApp", "\"" + appDirPath + "MyApp.exe\"");
key.Close();
}
protected override void OnAfterUninstall(System.Collections.IDictionary savedState)
{
base.OnAfterUninstall(savedState);
RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);
key.DeleteValue("MyApp");
key.Close();
}
}