This is written in the context of an Visual Studio 2010 and VSTO Excel add-in, that I created and had to deploy using the setup project after exploring all other options including ClickOnce, Wix, InstallShield and what-not. As it turns out, the Visual Studio Setup Project remains to be the easiest to understand and use. Yes, it has its limitations, but for the majority of the cases, I am sure it will just work.
First off, create the Setup Project the way you would with any other projects. The project will appear in the project explorer and here is the first big tip: All the features of the setup project are tucked into the context menu of the project icon.
If you look at the project tree and the main workarea, you don’t see very much and it’s not obvious how to get started right away. But if you right click on the project icon, you see that besides the usual “Build”, “Rebuild”, “Properties” and the file options, you also get new options “Install”, “Uninstall” and the unassuming “Add” and “View” submenus. “Install” and “Uninstall” are self-explanatory, but the “Add” and “View” submenus are not the usual lads. “Add” allows you to add files to be installed onto the client system, and “View” allows you to change various settings that you would want to. Finally, the obscure “Pre-requisite” button is in the properties dialog you get when you click on “Properties” in the context menu.
Start customizing your setup.exe by adding files. The project automatically detects the primary output files (dll, exe) and dependencies, but you must remember to manually check and add additional content and configuration files as required by your application. In terms of my VSTO application, I must manually add the *.manifest and *.vsto files and other content files that my add-in access during runtime.
Then we set the default install location (or Application Folder) to [LocalAppDataFolder][Manufacturer]\[ProductName] under View > File System.
Next, use the view menu to customise any other settings you need. In the case of my VSTO add-in, a registry entry is required for excel to detect and load my add-in. The registry key to create is HKCU\Software\Microsoft\Office\Excel\Addinds\MyVSTOAddInName with following keys:
- String Description = “Description for my add-in”
- String FriendlyName = “Short name for my add-in”
- DWORD LoadBehavior = 3
- String Manifest = “[TARGETDIR]vstofilename.vsto|vstolocal”
Note that [TARGETDIR] is a variable in Setup Project to in the client install directory for our application files.
Finally, for my VSTO application, I need to remove the option for user to install my application “for all users”, so I go to view > User Interface > Installation Folder and under its properties set InstallAllUsersVisible to False.
This would be a most basic setup and really, the trick is still to know that all the features are found in the context menu so that you know what lingo and terminology to use and the rest is pretty much handled by Google!