We use WiX (http://wix.sourceforge.net) to generate the installs, which is a bit different than the build in VS installs. The basic idea is still the same. You use a Custom Action that calls an EXE in your install that looks for a certain "/uninstall" command line argument and then performs the deactivation.
So in our case, the DeployLX.exe startup code looks for /uninstall and calls each of the installed components and asks them to uninstall.
The code to uninstall looks like this:
Try Dim info = New LicenseValidationRequestInfo() With { _ ' If they don't have a license we don't want to prompt for a serial DontShowForms = true } Dim license = SecureLicenseManager.Valdiate(Me, Nothing, info) If license IsNot Nothing Then SecureLicenseManager.Deactivate(Me, Nothing, nul) End If Catch ex As NoLicenseException ' Ignore no license End Try
try { var info = new LicenseValidationRequestInfo(){ // If they don't have a license we don't want to prompt for a serial DontShowForms = true; } var license = SecureLicenseManager.Valdiate( this, null, info ); if( license != null ) SecureLicenseManager.Deactivate( this, null, nul ); } catch( NoLicenseException ){} // Ignore no license