This documentation is archived and is not being maintained.

Walkthrough: Integrating Activation into a Setup Project

There are many deployment tools that provide a setup framework with which you can create an installation package with embedded activation for product deployment. In addition to the deployment tools included in Microsoft Visual Studio 2005, installation tools that support Microsoft Windows Installer may be available from third-party vendors; these tools may support additional Windows Installer features that are not supported by Visual Studio deployment. 


With Microsoft Software Licensing and Protection (SLP) Services, the deployment process is a little different. A typical deployment process adds one or more deployment projects to a solution; each deployment project specifies instructions for installing files and components on a target computer. However, when you want to deploy a protected application, you add protected binaries, and a custom action that performs product activation. This walkthrough uses the Windows Installer Deployment model and the Visual Studio Setup Wizard to create the installation package and provides an end-to-end deployment approach from application protection to installation and activation in a setup project. 


This walkthrough guides you through the following steps:

  • Protecting your intellectual property
  • Including binaries in setup
  • Creating a setup project wizard with integrated activation


Protecting Your Intellectual Property 

Microsoft Software Licensing and Protection (SLP) Code Protector provides the ability for developers to specify exactly what code to protect through code transformation. After your application is ready for release, use SLP Code Protector to protect your application. When selecting code to protect, choose those classes and methods possessing a high intellectual property component, or those that are particularly vulnerable to hacking or reverse engineering, including the following:

  • Staging or initialization methods that permit access to functionality you want to control.
  • Methods that enforce licensing.
  • Code that implements algorithms unique to the product.
  • Code that contains information about the infrastructure of the enterprise: database connections, passwords, etc.

Detailed instructions for using SLP Code Protector are available in the Code Protector User's Guide on the Microsoft Download Center. (The Code Protector User's Guide is a Help file included in the Software Licensing and Protection Services 2008 - Code Protector SDK.) 


Including Binaries in Setup 

Before you create an installation package, you must include several assemblies (binary files) in your setup project that are created at the time you protect your application — the permutation assembly, Microsoft.Licensing.Permutation_Permutation ID_2.0.dll, and two Microsoft Software Licensing and Protection (SLP) Services assemblies, Microsoft.Licensing.Runtime2.0.dll and Microsoft.Licensing.Utils2.0.dll. You include these protected versions of your binary files instead of the original files. 


Permutation ID
A Permutation ID is the first five characters of the permutation name.

SLP Services provides an application that creates a fingerprint for any block of code you specify, whether it is a feature or a specific method. 


Creating a Setup Project Wizard with Integrated Activation 

When you create a setup project for a protected application, you must include the protected binary files instead of the regular release files from your Visual Studio project. In addition, you must include the permutation file and the SLP assemblies. Incorporating activation within the setup project streamlines the entire installation of your protected application for your customers. The following procedure guides you through creating a setup project with integrated activation. 


Note: The following procedure refers to a protected application called SLPTestAppliction and its executable. This application is not provided with this walkthrough, but is used as an example. Any protected application is a viable substitute. 


To Create a Setup Project and Integrate Activation 

  1. Create a new setup project.
  2. Add the protected application to your setup project.
  3. Create an activation dialog box.
  4. Create a new class library to implement a custom action. 
  5. Add the references and code to implement the custom action.
  6. Open Activation Installer.cs. Add the following using statements.  
  7. Add the following code to Activation Installer.cs. To the namespace statement, add the RunInstallerAttribute attribute.
  8. Create a custom action.
  9. Build and run the installer.
What do you think about this topic? Send feedback!