Deploying Add-Ins

At some point when you are developing add-ins, you may find that you want to install and run them on another computer, a process known as deployment. Visual Studio 2005 has a special project type called a Setup Project that allows you to do this. To enable your add-in to be deployed, you simply add a new setup project to your add-in's solution. The setup project, when compiled, creates a Windows installer (.msi) file which, when run on the target computer, installs the necessary files. For a Visual Studio 2005 add-in to run on a target system, it must have the add-in's compiled assembly file (.dll) and its supporting XML registration file (.addin), as well as any dependent assemblies, such as EnvDTE.dll and EnvDTE80.dll.

 

The following steps demonstrate how to add a setup project to your add-in and how to deploy it on a target computer.

 

  1. Load a Visual Studio 2005 add-in solution. If it has not already been built, then build it.
  2. Add a new setup project to the solution. To do this, click File / Add / "New Project," and then select "Setup and Deployment" / "Setup Project."
  3. Give the setup project a name, such as MyAddin1_Setup.
  4. Right-click the setup project and select Add / "Project Output" / "Primary Output." This adds any dependent files that the add-in requires, such as the EnvDTE and EnvDTE80 assemblies, and it displays the File System Editor in Visual Studio 2005.
  5. In the File System Editor, create a custom File System folder node. To do this, right-click "File System on Target Machine" / "Add Special Folder" / "Custom Folder," and then name it AddIns Folder. You must create your own custom folder because there is no preset target name for the AddIns folder, and that folder is required for add-ins to be recognized by Visual Studio 2005.
  6. In the AddIns Folder properties window, click the DefaultLocation property and enter [PersonalFolder]\Visual Studio 2005\Addins. This is one of the default places where Visual Studio 2005 looks for add-ins.
  7. Right-click the AddIns Folder node and then click Add / File.
  8. Add two files: the add-in's DLL file (such as MyAddIn1.dll) and the add-in's .addin file (such as MyAddin1.AddIn). These are the files that will be copied into the target's Addins folder.
  9. Build the project. This creates an .msi installation file.
  10. Copy the .msi file to the target system.
  11. Run the .msi file on the target system. This installs all the files you specified in the setup project.
  12. Run Visual Studio 2005.
  13. Click Add-in Manager on the Tools menu.

You should see your add-in appear in the list of available add-ins, ready to be loaded.

 

Another alternative option you can employ that is new to Visual Studio 2005 is called ClickOnce Deployment. This new type of deployment method allows you to publish Windows-based applications to a web server or network file share. This is a good way to create a centralized installation point for an add-in if you have to deploy it to several computers on a network or to customers with web access who live in various locations around the world. For more information about ClickOnce and how to set up your projects to use it, see the following topic in Visual Studio 2005 Help: ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_deploy/html/abab6d34-c3c2-45c1-a8b6-43c7d3131e7a.htm.

 

After you deploy an add-in as an .msi file on a remote system, you can remove it by going to Add/Remove Programs in the Control Panel and selecting it from the list of installed programs. To remove an add-in and its components from a local system, see the following Help topic:

How to: Deactivate and Remove an Add-in -- ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_extcore/html/5d9bc34f-ab3b-4477-950f-79fb820acb8c.htm

 

There are also a number of Help topics that more fully describe the available installer options, such as the properties you can use to create custom installation folders, how to deploy COM and Windows apps (and add-ins) on web sites, and so forth. For more information, see the following Help links in Visual Studio 2005:

 

Walkthrough: Deploying a Windows-based Application -- ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_deploy/html/02cbce50-6fc2-4b89-bc32-3720a7651087.htm

 

Files, Folders, and Deployment -- ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_deploy/html/92e6c2e4-3567-45b8-9ca9-4df5aded22e3.htm

 

Kemp Brown, programmer writer