Develop Office Business Applications using Visual Studio
An often-requested feature for VSTO add-ins is the ability to install an add-in for all users of a machine. Misha Shneerson had blogged about a workaround to enable this scenario here. This workaround is not recommended. Now, deploying an add-in to All Users is supported for both Microsoft Office 2007 (through a hotfix) and Microsoft Office 2010.
With Office 2010, it is possible to directly register a VSTO add-in under the HKLM Office add-ins registry hive such that the add-in gets installed machine wide for all users of the machine.
The registry keys under HKLM are very similar to the registry keys for the current user as described in this MSDN topic. Each Office application has its own node at the following location where it will try to load add-ins that are installed machine wide:
e.g. HKEY_LOCAL_MACHINE\Software\Microsoft\Office\application name\Addins\add-in ID
These machine wide add-ins load and behave similar to add-ins that are installed per user, However, there are some important differences you should remember when deploying such add-ins.
1) You need administrative privilege on the machine in order to install an All User add-in.
End users running with current user privilege cannot install/uninstall or disable an add-in. This could potentially lead to a worst case scenario where an add-in fails unexpectedly resulting in the host Office application crashing, and the end user cannot do anything to stop the Office application from crashing because they cannot disable the add-in causing the crash. So, make sure your add-in is thoroughly tested before deploying to it to all users of a machine.
2) An all user add-in cannot be deployed through ClickOnce and must be deployed through a Windows Installer MSI.
Writing to HKLM requires administrative privileges, so you cannot use ClickOnce to deploy your add-in because ClickOnce only works with current user privileges. This means that you need to create your own MSI package that registers the add-in under HKLM and installs it for all users. This whitepaper and MSDN topic should give you the necessary background information to create a MSI package for your VSTO solution. The most important thing to remember while creating this all user installation is to always append a “|vstolocal” to the manifest registry value pointing to the add-ins deployment manifest location.
e.g. manifest = “C:\Program Files\MyVSTOAddIn\MyVSTOAddIn.vsto|vstolocal“
Appending the “|vstolocal” tells VSTO to run the solution from the installation folder (like C:\Program Files\MyVSTOAddIn) instead of installing and running it from the ClickOnce cache.
3) Trusting the Add-In for all users
To trust an add-in for all users of a machine, it must be signed with a Trusted Publisher’s Certificate (See Authenticode Certificates in Granting Trust to Office Solutions and How to: Add a Trusted Publisher to a Client Computer for ClickOnce Applications for more information). If the add-in is not signed with a trusted publisher’s certificate, each individual user sees the Microsoft Office Customization Installer dialog box (aka trust prompt) asking them whether they want to install the add-in the very first time the add-in is loaded for them. If they choose to install the add-in, the add-in will run and they will not be prompted again. However ,if they choose to not install the add-in, the add-in will not load and they will continue to see this trust prompt every time they open up the Office application and the add-in tries to load. If you are developing your solution with Visual Studio 2010 and targeting .NET 4, an alternative to signing with a Trusted Publisher certificate is to install the add-in into the machine Program Files location. This location also needs administrative privilege to write to and will be inherently trusted by VSTO, so there will be no trust prompt even if the solution is not signed with a Trusted Publisher certificate.
4) Installing on 64-bit Operating Systems
Unlike the HKCU registry hive, the HKLM registry hive for Office add-ins is redirected on a 64-bit Windows OS. So if you are trying to register an add-in with 32-bit version of Office running on a 64-bit OS, the add-ins registry will be under the WOW6432Node. The 32-bit Office running on 64-bit OS will always load the add-ins listed under this key.
e.g. HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Office\application name\Addins\add-in ID
A 64-bit version of Office 2010 on 64-bit OS will always load the add-ins under this key:
With the ability to directly register and load VSTO add-ins from the HKLM hive on Office 2010, you can easily deploy VSTO add-ins to all users of a machine and no longer need to follow the steps outlined in Misha’s blog
Update for Office 2007 A recent hotfix (KB976811 available through KB976477) for Office 2007 also makes it possible to register and load VSTO add-ins under HKLM for Office 2007. The process works exactly like Office 2010 but to make this work for Office 2007 you will have to download and install the hotfix on every machine where you want to deploy the all user add-in.
In conclusion, you can install an Office2007 or Office 2010 add-in to All Users if you use Windows installer to deploy your add-in and the add-in is installed with administrative privileges. To secure your All Users add-in, sign your Office add-in with a certificate that is in the Trusted Publisher list or install the add-in to the Program Files directory.
I created a Word-Addins using this link
I am using Word 2007 +VSTO2008.
But I am able to deploy this addins for all users of my machine.
When i sent the word document to my client,my client is not getting that addin.
I have 2 Question-
1) can u guide me how can i deploy word Add-ins to all users of my machine.
2) what are changes i have to do that my client also get this work add-ins with word document.
Thanks in Advance.
I have a VSTO 4.0 Excel 2007 Add-in built using VS 2010. I followed the steps in this post, but it does not seems to work. It does show up in the Excel add-ins list, but the LoadBehavior gets set to 0 by Excel no matter what I do. Any ideas why or how to work around it? I tried resetting it by hand in the registry, but it sets it back as soon as I launch Excel.
I am getting the same issue, have you found a solution?
@Keiran No I haven't. I've tried everything I can think of. It seems the only way to deploy this is with ClickOnce, but I need to be able to deploy this without ClickOnce. It would be nice if someone on here would step in with some help. (Hint, hint).
Thanks Erick, Have you posted on social msdn forums? I might do that today and let you know if I get a response.
There are a number of things that can cause a VSTO add-in not to load. I would start by following the steps in the following blog blogs.msdn.com/.../troubleshoot-vsto-add-in-load-failures-navneet-gupta.aspx. Once we have a better idea of why the add-in is failing then it might be easier for someone in the forums to help with the troubleshooting.
I would definitely recommned posting to the Office Development Forum as there are a number of experts who monitor and respond to issues that come up in that forum and you will tend to get a response more quickly than via the blog.
@Keiran - I found a solution to my problem! Here's the description.
I had the Hotfix installed, but I didn't have the registry key to make it work: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\12.0\Common\General\EnableLocalMachineVSTO
Hopefully this will help you.
Thanks Erick, I suspect thats what I missed as well. Also thankyou Rachel :)
I created an addin for Excel 2010 using VS 2010. When I tried to install it using MSI on 64bit OS (Window 7) and Office 2010 64bit for all users. I found that HKLM\Software\Microsoft\Offfice key does not have EXCEL subkey. Why this key was not created by default? Will I have to install some hotfix? Kindly point any hotfix.
I cannot seem get this to work for Office 2007, and I believe I have followed the instructions in this blog *exactly* to a tee.
Specifically, I have:
1. Applied the hotfix package 976477 for Office 2007
2. Enabled the hotfix by adding the DWORD value EnableLocalMachineVSTO (and setting it to 1) to the following reg key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\12.0\Common\General\
3. Created a demo VSTO Excel AddIn using VS 2008, and following the instructions in the whitepaper
"Deploying a Visual Studio Tools for the Office System 3.0 Solution for the 2007 Microsoft Office System Using Windows Installer (Part 1 of 2)", created a setup package for it. My only deviation from the instructions in the whitepaper is that I configured the registry in the installler to write to:
When I run the installation on my test deployment machine, the expected registry entries are there, but the AddIn never shows up in the Excel 2007 COM Add-Ins dialog.
If I change the install package to deploy to a single user and configure the reg entries to write to HKEY_CURRENT_USER\Software\Microsoft\Office\Excel\Addins\SampleCompany.ExcelAddIn,
then the AddIn does show up in the Excel 2007 COM Add-Ins dialog (and it does work).
But of course, the whole purpose of this excercise is to deploy to ALL users, and I haven't been able do it. I've spent days at this and am tearing my hair out. (Actually, I'm already bald -- this is the price I pay for being a programmer.)
What am I doing wrong here? Thank you.
@MalikIrfan - Office 2010 does not need an hotfix. Maybe the key is not present because there are no all user addins installed on that machine. Also make sure that it is indeed 64-bit Excel as 32-bit Excel would use the key under the Wow6432Node.
@Stephan - Could you also check that if its a 64-bit OS. The key for Excel 2007 which is 32-bit would be under the Wow6432Node on a 64-bit OS.
I followed the instructions to deploy the Office Add-ins for All Users on a Office 2007 system. It works fine on Windows XP.
However, when I try it on Windows 7 with default UAC level, it gives an error -- "The connected state of Office addins registered in HKEY_LOCAL_MACHINE cannot be changed."
It works fine when I lower the UAC. Is there any way to make it work on Windows 7 without lowering the UAC?
Also, note that once the add-in is loaded, if I again change the UAC level to default, it works fine from next time.
we want to implement a vs2008 vsto solution to all users on a citrix environment (windows 2003 server). There is a addin key in local_machine, inclusion list is added in hkey_current_user through login-script.
The solution works for users who have administrative rights. But users with priviliged rights get an error starting Word: "The customization cannot be installed because another version is currently installed and cannot be upgraded from this location"
Can someone explain what's missing here?
I have created vso addins for word and powerpoint. Now i want to create a single setup for both 32 bit and 64 bit machine. Is it possible? if yes, then how it will be created. And how the setup will run according to machine type i.e. 32 bit and 64 bit.
Please help me...
Dear Saurabh sir ,
my problem is regarding VSTO 2005 SE word 2003 addin for all user.
We have made a word 2003 Addin but when we are trying to install our Addin for all user , it is not working as expected .when admin account user install it for all user then it work only for his account but not for other users. It does not even show in com Addin on toolbar.
As we can judge, our registry entry settings are correct under both HKCU and HKLM.we have kept same registry settings for both HKCU and HKLM.are we have to do something different than these settings?
I am attaching a picture which tells about registry entry setting of our word 2003 Addin .
We are using caspol security policy for granting full trust to assembly. We grant full trust to machine level.
User is admin so there is no issue of permission or privileges.
I have gone through an article social.msdn.microsoft.com/.../1435e0d4-19d0-4b3f-98af-558007ab760d . but it did not solve our problem.
I want to give you some more info about environment
• Visual studio 2008
• Visual studio 2005 tools for office second edition runtime
• Visual studio built in setup and deployment.
• We have found one strange situation that when we install word 2003 Addin for all user by admin account ,here Addin loads fine ,and then switching to another admin account Addin does not load but again switching to previous admin account and opening word 2003 again , but this time Addin does not load. Then we found that loadbehaviour from registry entry under HKLM is changed to “2” .