Advertisement
Advertisement
| 01.04.2008 at 04:32AM PST, ID: 23058315 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: |
public override void Install(System.Collections.IDictionary stateSaver)
{
base.Install(stateSaver);
RegistrationConfig rc = new RegistrationConfig();
rc.AssemblyFile = GetType().Assembly.Location;
rc.ApplicationRootDirectory = System.IO.Path.GetDirectoryName(Context.Parameters["assemblypath"]);
rc.InstallationFlags = InstallationFlags.FindOrCreateTargetApplication;
RegistrationHelper regHelper = new RegistrationHelper();
regHelper.InstallAssemblyFromConfig(ref rc);
// Save the state - you will need this for the uninstall
stateSaver.Add("AppID", rc.Application);
stateSaver.Add("Assembly", rc.AssemblyFile);
}
public override void Uninstall(System.Collections.IDictionary savedState)
{
if (savedState == null)
throw new ArgumentNullException("savedState", "Saved State is required to uninstall this application, please repair and try again");
base.Uninstall(savedState);
// Get the state created when the app was installed
string appID = (string)savedState["AppID"];
string assembly = (string)savedState["Assembly"];
// Uninstall the application
RegistrationHelper regHelper = new RegistrationHelper();
regHelper.UninstallAssembly(assembly, appID);
}
|