0

I am working on Visual Studio 2010. I've developed a WPF C# application which will be deployed to customers trough a website. After downloading and installing it they will have to register the application which will send info to the server and also write some registry entries. I have created a Setup Project in order to create the installer package for my app. It installs correctly and auto-registers the app in Control Panel/Add Remove programs, which is great if the user wishes to uninstall the program some day.

Question: How can I force the uninstaller to execute some code or launch another application in order to send info to the website that the current user is deactivating and uninstalling the program?

The Problem: If the user uninstalls the program as it is right now, only the files are deleted, and eventually the registry values, but the website will continue to think the user still has an active copy of the software and if he wants to download it again, the website would not let him do it.

mandarin
  • 1,316
  • 1
  • 15
  • 27

2 Answers2

1

You have to implement install actions, and run them in the appropriate set up event.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Deployment.WindowsInstaller;

namespace CustomAction1
{
public class CustomActions
{
    [CustomAction]
    public static ActionResult CustomAction1(Session session)
    {
        session.Log("Begin CustomAction1"); // Here you can write your own custom action code
        return ActionResult.Success;
    }
}
}

Select the CustomAction1.CA.dll file and add it to your Advanced Installer project Go to Custom Actions Page, add a “New Installed Custom Action” with sequence from Add Custom Action Tab or the toolbar and select CustomAction1.CA.dll In the "Function Name" field from the "Custom Action Properties" view select CustomAction1 Build the project and test it

http://www.advancedinstaller.com/user-guide/qa-c-sharp-ca.html

Oscar
  • 13,594
  • 8
  • 47
  • 75
  • Everything works great, except one thing: When the uninstaller is started it creates a temp folder "Uninstall.CA.dll-" in my install dir. There it unpacks the Custom action dll, but after the uninstall is completed the dir remains empty and is not deleted. – mandarin May 27 '14 at 08:51
1

If your setup project is a Visual Studio setup project, then basically you just need to add a custom action for install and one for uninstall. This is old but still relevant - you can arrange to run a program at the end of the install and on an uninstall:

Getting Stsrted with Setup Projects

PhilDW
  • 20,260
  • 1
  • 18
  • 28