Deploying VSTO add-ins can be a real pain, at least if you are not using 2010. Having just successfully deployed my first add-in, I thought it would be useful to explain how I did and the resources I used.
Firstly, it is important that you follow the instructions for the appropriate version of Office and Visual Studio that you are using. My example is for a legacy solution using Office 2003, created with VSTO Second Edition (Visual Studio 2008). The general principles are the same for other editions, but the specifics may be subtly different.
To get started, look at the walkthrough here:
This is another useful collection of resources:
This explains how to configure a deployment project in Visual Studio 2008 and set up the additional security package required to grant the add-in full trust. I would recommend you follow the steps in here to create a brand new simple package and get that working first. I created a simple Word 2003 add-in package to test, rather than the suggested Outlook.
The security package can be downloaded from MSDN here:
Unpackage the download and you should find a .SLN file that has everything pre-configured. Copy the "SetSecurity" package from here and add it to your solution as explained in the walkthrough. Configure the Setup project's outputs as described, and you should end up with a package that looks something like this:
Once you have built your setup package, you can find the .MSI and .EXE files in solution bin/debug (or bin/release) directory. Run the .exe and you should have installed your add-in onto your development machine. Run the appropriate Office application to check that the pop up message appears to confirm this. Your development computer should have all the pre-requisites installed, so if this doesn't work you have probably missed something in the walkthrough, or have perhaps used an incorrect version of the setup project, so go back and double check everything. It is vital that you get a simple version working at this stage, or it will cause you all sorts of problems down the line.
Once you have a simple install project working you can go about making it available to ALL USERS on the machine. This is not covered in the walkthrough, although there is mention of it for newer versions of Office in this excellent blog here:
In Office 2003, deploying to all users is actually really simple: all we have to do is copy the registry keys that have automatically been generated for us by Visual Studio in the Setup project from HKCU to HKLM. In practice, this mean highlighting your setup project (called Word2003AddInSetup in my example), right click and choose "View" and "Registry":
You can now drag the "Software" key from the HKCU leaf to the HKLM leaf. Once done, drag your renamed "SoftwareTESTTESTTEST" key from HKLM to HKCU, and rename this back to "Software". You should now have something that looks like this:
That's it! Build your setup solution and re-install it (you will have to un-install your original version first). You should now find that any user that logs into the machine will have the add in enabled.
Please note that if you are using Office 2007, this technique does not work - you will have to refer to the blog post linked above to learn how to set up the appropriate registry keys.