Installation of VSTO by adding registry in end user computers - excel

I've developed a VSTO addin for excel with VS2019. In my company execution of exe files are controlled by privilege management software (https://www.beyondtrust.com). For this reason, I don’t want to crate window installation file or setup.exe file. For this reason, I am traying to install VSTO by adding registry. My steps are as follow,
I have run VSTO addin from VS2019.
I have copy all registry from
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\Excel\Addins
HKEY_CURRENT_USER\SOFTWARE\Microsoft\VSTO\Security\Inclusion
HKEY_CURRENT_USER\SOFTWARE\Microsoft\VSTO\SolutionMetadata
Deleted all above-mentioned registry.
Moved all files (dll, manifest, VSTO etc) generated by VS2019 in new folder.
Re added all registry with old GUID and RSA key but only modification of path for new path of VSTO files.
After that whenever I launch excel, my addin do not load and load behaver changed from 3 to 2. No matter even I change to 3, it got changed as 2. It always shown me my addin in inactive addin my option of excel.
Can anyone guide me?
Thanks

Best way is to create COM-AddIn using IExtensibility instead of VSTO addin.
It is similar to VSTO. Only change is u need to do everything by yourself including
user/machine registry

Related

clickonce auto update issue

I have an excel vsto add-in. I am distributing this add-in by sharing the clickonce installer file. Later, I tried to make this application auto update. for auto updating my application, I created a c# console application, which
downloads the latest clickonce installer
closes the excel
uninstalls previous version of addin
opens the clickonce installer
the first 3 steps are working fine.
for the fourth step I used Porcess.start('file_location to clickonce setup.exe)
if the user account is admin, there would be no problem, otherwise it would ask for admin password, if the admin password is given, the addin gets installed in the admin account and not in the user account.
I am struggling to actually understand how to auto update vsto addins if clickonce is used and distributed manually.
I think you may have misunderstood how ClickOnce is intended to be used with VSTO.
Basically all you have to do is deploy your addin using ClickOnce see
here which it sounds like you're already doing and then under Project Properties - Publish look for:
Install Settings - Updates - Set to your update interval (e.g. every time the customization runs)
This will then cause your VSTO addin to update automatically every time Excel starts (or based on your interval). There's no need to manually fire off the installer, close Excel, etc. it's all handled by ClickOnce.
That being said, according to this and that MSDN link, ClickOnce is not suitable for multiple users, but I assume that your use case is to have the same user both install and use the Addin.

Using Registry to install Excel AddIn

I created an excel Add-In called
Project Count_Per Person.xlam
When I open up excel and go to Development>AddIns and select my AddIn to install, it does not stay installed if I close out of excel even after saving. The AddIn I made, creates a new MenuBarButton under the tab 'AddIns'
So I created a new registry Key to install the addin at startup under
HKEY_CURRENT_USER\Software\Microsoft\Office\Excel\Addins\ProjectCount_PerPerson
The Key looks like this
(Default) REG_SZ (value not set)
Description REG_SZ Project Count_Per Person
FriendlyName REG_SZ Project Count_Per Person
LoadBehavior DWORD 0x00000003 (3)
Manifest REG_SZ C:\Users\b012918\AppData\Roaming\Microsoft\AddIns\Project Count_Per Person.xlam
When I start Excel, it displays that it is installing the AddIn, but then I get an
Exception reading manifest from
file:///C:/Users/b012918/AppData/Roaming/Microsoft/AddIns/Project%Count_Per%Person.xlam:
the manifest may not be valid or file could not be opened.
http://pastebin.com/bN1datV5
Any insight into what I'm messing up would be beneficial.
Additional Information:
If the addin is uninstalled when I start excel, it gives the manifest error. If the addin is 'checked' when I start excel, it gives the download error in the comment below. Even if the addin is previously installed, the CommandBarButton does not stay in place. Also, under options--> addins the addin is stated to be "Active".
Just to clarify, there are two types of addins for Excel (and the other Office apps), VBA addins and COM addins. A COM addin is developed via Visual Studio and the Visual Studio Tools for Office. That is what brett s is referencing to.
But the more likely type are normal VBA Excel Addins, typically distributed via a .xlam file.
In order to load such an addin automatically for a user, you need the addin file on some local directory on the machine and reference it via the Registry.
For Excel 2010, a REG file to load the corresponding registry key is:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Excel\Options]
"OPEN"="C:\\Path\\To\Addin\\Addin.xlam"
This way the addin is loaded everytime you start Excel.
I Built an Add-In called 'FirstExcelAddIn' with Visual Studio, and checked to see what it did when It built the Registry Keys. I had my registry correct from the keys shown in the question, I just did not have all the files it was looking for in a COM addin.
Here is what my functioning addin looks like in the registry
(Default) REG_SZ (value not set)
Description REG_SZ FirstExcelAddIn
FriendlyName REG_SZ FirstExcelAddIn
LoadBehavior DWORD 0x00000003 (3)
Manifest REG_SZ C:\Users\b012918\AppData\Roaming\Microsoft\AddIns\FirstExcelAddIn.vsto|vstolocal
Here are the files that need to be present in the folder for the addin to work properly
FirstExcelAddIn.dll
FirstExcelAddIn.dll.manifest
FirstExcelAddIn.vsto
Microsoft.Office.Tools.Common.v4.0.Utilities.dll
I suspect that if you went through the effort to write your Add-In from scratch without tools, you would only need the '.dll' and '.dll.manifest' for your addin to work.

VSTO Addin Creates 2 items in Add/Remove programs

I have created a vsto addin in VS2012. I have added an installation project to the solution using Installsheild LE. After installing the exe that I get, I get the expected item added to my add/remove programs. However when I open Word, I get prompted with a Microsoft Office Customization Installer prompt which says the publisher is unknown. I click OK to this and it adds my addin as expected, which all works fine but I also get a second item appear in my add/remove programs.
Can anyone tell me why I am getting the second item in add/remove programs and offer any advice about what I should do to avoid this?
You have to add "|vstolocal" to the addin registry value that points to your addin file. This tells ClickOnce to run it directly and not install it per-user.
You also want to digitally sign the addin using a certificate issued by someone in the users trusted root. This could be VeriSign or others. If you create your own certificate you have to use custom actions to install the root certificate in the certificate store and to register the publisher cert as a trusted publisher.
I've created about a dozen of these installers over the last 8 years and it's tricky at first but gets easier over time. Several of my customers are using InstallShield LE to get the prereqs installed but then I factor all the components out into a WiX merge module where I can use things like the Util extension to install certificates.
It looks like you use ClickOnce and MSI installers to deploy the add-in. You need to remove any of them. Both kind of installers are described in the following articles in MSDN:
Deploying an Office Solution by Using ClickOnce
Deploying an Office Solution by Using Windows Installer
Is that your dev machine and got Visual Studio in it? I have seen this happened with Windows 7 during development the addin is added in to add/remove programs. This has gone later when I updated my Windows 7 machine. Some updates from Microsoft has removed this later.

Does Excel Add-In VSTO 2005SE Need Manifest Files?

We developed application level Excel Add-In in Visual Studio 2005 using VSTO 2005SE. The add-in installs and works fine on Excel 2003, 2007 and 2010 (32-bit) on the most of computers. However, in some cases Excel does not load it, despite the fact the registry LoadBehaviour (LB) value is set to 3 during the installation. When the user un-installs the add-in the LB is still set to 3, so I assume there is no error happens during initialization and loading, otherwise LB will be 2 or even 1.
We use MSI installation and deploy the add-in on application level with Local Machine registry keys.
When we build the add-in in Visual Studio 2005 there is no manifest files generated, so we don’t include these files in our MSI installation and there is no registry key entry for the manifest. So, we assumed the manifest is not essential part.
Even more, according to http://msdn.microsoft.com/en-us/a3swb498(v=vs.80) the application manifest provides information that is used by an Office solution to locate and update its assemblies. Since we have only one assembly that is a solution, we don’t need any manifest.
Our MSI file, add-in assembly and setup.exe files are signed with the COMODO certificate.
Does anyone know if we need an application and deployment manifests and if so how can we generate ones?

Where should VSTO-developed extensions be installed?

I am building an extension ribbon for Excel. Besides the ribbon DLL I will have a data access DLL and a .sdf (SQL CE database file). In which directories should they be installed? Is there a best practice for deploying this project? It will be used at several sites around the country.
Generally, I install vsto addins just like any other addin or application. I have the installer create a \program files\MyCompany\MyApp folder, put the dlls, and the addin's Manifest and config files right there. Maybe create a few subfolders to store other info. then Register the addin and point to that location.

Resources