Im trying to debug a setup project that I created in c# (VS)... I have the project currently set to a "Debug" and NOT "Release" and I have added the following code to my custom actions area...
public override void Install(System.Collections.IDictionary stateSaver)
{
if (Debugger.IsAttached == false) Debugger.Launch();
MessageBox.Show("Installing Application...");
//Continue with install process
base.Install(stateSaver);
}
//Code to perform at the time of uninstalling application
public override void Uninstall(System.Collections.IDictionary savedState)
{
if (Debugger.IsAttached == false) Debugger.Launch();
MessageBox.Show("Uninstalling Application...");
//Continue with uninstall process
base.Uninstall(savedState);
}
When I go to install (Right click on setup project-> install) it works as expected and I can use F11 to step through each line. When I go to uninstall (Right click on setup project-> uninstall) it will not let me step through using F11 or continue using F5 or see any of the intellisense popups (like variable values, etc). Though I can click the file menu option to do each (Debug->Continue and Debug->Step Into).
Any ideas why that's the case and how I might be able to get that functionality?
Additional Question: Is it possible to change any code (like adding a message box) while stepping through the setup project during runtime like you would with a normal program?
Solution: In my case I was trying to debug my custom install actions Install() and Uninstall(). I ended up adding the following to my custom actions...
if (Debugger.IsAttached == false) Debugger.Launch();
That was simple enough, below is an example of it in place...
//Code to perform at the time of installing application
public override void Install(System.Collections.IDictionary stateSaver)
{
if (Debugger.IsAttached == false) Debugger.Launch();
CustomParameters cParams = new CustomParameters();
cParams.Add("InstallPath", this.Context.Parameters["targetdir"]);
cParams.SaveState(stateSaver);
//Continue with install process
base.Install(stateSaver);
}