Outlook AddIn gives "AddIn element not found in XML" error on install - vba

I've created my first Outlook 2010 AddIn using VS 2012 but I'm having trouble creating a setup.exe.
I'm using clickOnce to publish the setup.exe files but when I try to install the AddIn, I get the same message as this guy - Error deploying VSTO Office addin
It turns out I cannot create MSI installer in VS2012 as written in the accepted SO answer because MS no longer supports it. Instead I am to use InstallShield to create the setup.exe. I tried that with the steps outlined in this video - http://resources.flexerasoftware.com/web/demos/IS2010_VSLE_Demo/IS2010_VSLE_Demo-lite.html
That failed too. For some reason it cannot find the .vsto file which doesn't seem to get created! The file path it looks for is also wrong even though I did specify in the registry "[TARGETDIR]… |vstolocal" per the instructions from an MSDN page.
Question: What do I need to do to fix either the clickOnce installer error or the InstallShield error?
I don't care which deployment method I use as long as:
1. it WORKS!
2. I can copy the setup.exe (w/ any necessary files) on to a USB stick and give a few people to test the Outlook AddIn.
Thanks.

Thanks to Andy_mic in MSDN Forum, here's the answer:
Follow ALL the steps, step by step, in the following link: Deploying an Office Solution by Using Windows Installer
I ran into a couple of problems:
I did not have the GUI Generator installed as a windows program. See this post for solution: Is Tools > Create GUID removed in Visual Studio 2012?
The value for the Manifest in the Registry data of the AddIn should be: "file:///[INSTALLDIR]ManifestFileName.vsto|vstolocal". In my case the manifest filename was ABCAddin_v1_0_0.vsto and so the value has to be "file:///[INSTALLDIR]ABCAddin_v1_0_0.vsto|vstolocal"
If you do not find the deployment and application manifest files in the "bin/release" folder, its because you need build a release version of the project first!

Related

Advanced Installer VSTO Add-in Deployment to Entire Machine not working

I'm using Advanced Installer to try to create an installation package (single EXE setup file) for an MS Project VSTO add-in. I need the installation Type to be Per Machine but when I chose this option and run the setup.exe file, the Add-in will not load for any of the user's on the target machine. The only way I can get it to load is if I change the installation type to Per User, which I don't want.
I'm fairly certain the problem is related to the registry, because the setup.exe is not adding the proper registry keys under HKEY_LOCAL_MACHINE to load the add-in, even though I have it set up to do so:
What am I doing wrong?
There are other things that needs to be done except windows registry keys. For example, you need to specify whether you want to support per-user or per-computer installations.
The Deploy an Office solution by using Windows Installer article describes all the necessary steps for creating per-use and per-machine Office add-in installers. Make sure that you did everything in your installation package.

Difficulties using Windows Installer to Deploy a COM Add-In

I created a COM Add-In in Visual Studio 2012 and when I compile and run it on my machine, it works perfectly. The problem arises when I try to use the Windows Installer I created to install the Add-In. I am trying to install this Add-In to multiple machines and I would like to figure out that the issue is with the installer.
When I try to call a Sub from the COM Add-In with Excel, it throws a 'Subscript out of range' on the second line. The Sub connects to a SQL server, performs a query based on cell data, and returns the result. I looked at the Add-Ins in Excel, it is installed and not inactive/disabled. This same code works perfectly if I compile the project on my machine, just not when I install the Add-In with the installer.
Dim com as COMAddIn
Set com = Application.COMAddIns("SQL") <----
com.Object.ConStr
I followed this guide for the installer:
https://msdn.microsoft.com/en-us/library/Cc442767.aspx
I did the following to get the installer running (just a summary of the above article):
Added the Primary Output, .vsto, and dll.manifest files to the
application files
Added .NET Framework 4.5 (full) and Visual Studio 2010 Tools for
Office Runtime as prerequisites
Set the INSTALLDIR
Specified that the application should deploy to the current user
Told the installer to create the following registry path
HKEY_CURRENT_USER\Software\Microsoft\Office\Excel\Addins\JACOB.SQL
Created the following registry keys
Description SQL
FriendlyName SQL
LoadBehavior 3
Manifest file:///[INSTALLDIR]SQL.vsto|vstolocal
Set the Build to SingleImage
Set the InstallShield Prerequisites to 'Download from the Web'
Set the Active solution configuration to SingleImage
Set the Configuration of the installer to SingleImage
Built the Installer
I made sure to uninstall the compiled version of my project from Excel then went to the following file path and ran setup.exe.
%Visual Studio 2012%\Projects\SQL\Setup1\SQL_Setup\Express\SingleImage\
DiskImages\DISK1
After the installer completed, I ran the same code as above and it returned a 'Subscript out of range' error. As I said earlier, the same code works if I compile the code.
Dim com as COMAddIn
Set com = Application.COMAddIns("SQL") <----
com.Object.ConStr
I have researched what the issue may be and have come up mostly blank. I have found that I may need DllRegisterServer/DllUnregisterServer methods to add my dll to the registry with Regsvr32, but I have no idea how to write these methods. I also don't see how this could be the issue if the compiled project works without these methods. Maybe the installer skips a step?
Any help would be GREATLY appreciated. Thanks!

Installing VSTO Outlook addin for All Users to drive other than C: results in Microsoft Office Customization Installer dialog

First let me get this stuff out of the way:
This happens with my own addin, as well as another third party VSTO add-in, so I don't think I'm doing anything incorrect
.net 4.0. VSTO runtime 10.0.50701
Windows 8. Also tried Windows 7
I am using the |vstolocal suffix in the HKLM registry for the addin
I have also tried adjusting the 'program files' paths in the registry here: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion to point to my new 'F:' location, and that didn't change any behavior
Here are the steps I'm taking:
Create a new volume on a separate disk other than C:. I called mine 'F:'
Add the program files structures F:\program files and F:\program files (x86)
Install your VSTO addin (I'm using Outlook but it will happen with Word too) to "F:\program files (x86)" instead of the 'C:' drive
Launch Outlook.
Result is this dialog:
According to this, I shouldn't be getting this since its an all users install (see the Inclusion List section):
Is this a Microsoft issue? I realize I can add to the Inclusion myself however then I would be subscribing to more of a per-user approach, and that seems like a bad approach. Is this coming up because anything other than the 'real' program files folder cannot really be trusted by VSTO loader?
The dialog window belongs to the ClickOnce installer. But the link goes to the Windows Installer section in MSDN.
It is up to you where to install the add-in, there is no need to use the Program Files folder.
Make sure that you did all the steps described in the Deploying an Office Solution by Using Windows Installer article. It describes all the required steps for creating add-in installers.
I recently went through the same thing, i got this when i just published the vsto from vs2015. I tried using installshield, yielded the same issues, eventually i switched to wix installer, now i don't have any update checks running and its a clean install. These are some customization updates and our client actually had a firewall blocking it so the install failed. Try wix it worked great for me. Hopefully you don't end up with my current issue of not seeing the add-in if i am not running outlook as Administrator, driving me nuts, good luck.

OneNote 2013 Add-in won't load. How to debug?

I'm following the excellent tutorial by Malte Ahrens on how to create a OneNote add-in.
Initially I followed it step by step, making a few changes (just renaming the class, and using my own name and GUID in the assembly) info. As I'm using VS2012 and am not yet ready to hand-roll a WiX installer I manually copied over the built dll to the correct place and also created a registry file to make the requisite entries. I confirmed that they were all there, loaded up OneNote but no add-in, going to "mange COM addins" section I saw the following error:
Load Behavior: Not loaded. A runtime error occurred during the loading of the COM Add-in.
I spent some time debugging this but didn't get very far. So this afternoon I decided to start again but copy his code verbatim. I simply downloaded the example project, used the trial of Vdproj to Wix to create the installer and built everything.
I get the exact same error.
Why is this please? What does this mean and most importantly how do I debug the problem?
A few specifics about my environment and where it may differ from the original tutorial.
I am running Office 2013 AND it's 64bit. His tutorial is for 2010. This means when I loaded up the demo solution I had to remove the non-existent reference to the Onenote 14 Interop and add the v15 version.
In terms of registry entries they go to the right place, not the WOW6432 registry nodes. I doubly know this as if I load up OneNote and then refresh the HKCR registry node for the add-in, the LoadBehavior switches to 0x00000002, (disabled).
Other things that may be worth noting.
I have enabled OneNote logging and it's quiet on my issue.
There are 2 other posts on here with a seemingly similar problem (but Office 2010) here and here, neither got a response. The first guy had it loading once, but then had to manualy start it each time, mine never loads (and I've not signed my assembly) the second guy never got a response.
As I say, even knowing how to debug this further would be a great step forwards.
Edit:
I've gone back to debugging my own version, which is almost identical anyway as I'm not sure what the installer is actually doing and I think because it's a demo of the wix converter it's only allowing me to build for x86.
If I add OneNote.exe under "start external program" and run debug on my add-in, I see the following lines appear when I try and tick the add-in under "manage COM add-ins" within OneNote. I'm afraid I'm still pretty green at all this so I'm not sure what it means.
First-chance exception at 0x00007ffe4f86ab78 in ONENOTE.EXE: 0x800401FD: Object is not connected to server.
First-chance exception at 0x00007ffe4f86ab78 in ONENOTE.EXE: 0x800401FD: Object is not connected to server.
First-chance exception at 0x00007ffe4f86ab78 in ONENOTE.EXE: 0x800401FD: Object is not connected to server.
Also, since reading up more I think me simply copying my dll into the install folder program files\[manufacturer]\[application] (as I don't have an installer) was not enough. I've now executed this against my dll
PS C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319> .\RegAsm.exe
and it came back with
Microsoft .NET Framework Assembly Registration Utility version 4.0.30319.33440
for Microsoft .NET Framework version 4.0.30319.33440
Copyright (C) Microsoft Corporation. All rights reserved.
Types registered successfully
Is there anything else I should be doing to register the dll correctly?
Enable logging for OneNote 2013:
Create a file "EnableOneNote2013APILogging.reg"
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\OneNote\Options\Logging]
"EnableLogging"=dword:00000001
"EnableTextFileLogging"=dword:0000001
"ttidLogObjectModel"=dword:00000001
"ttidLogObjectModelAddins"=dword:00000001
Create a file "DisableOneNote2013APILogging.reg"
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\OneNote\Options\Logging]
"EnableLogging"=dword:00000000
"EnableTextFileLogging"=dword:0000000
"ttidLogObjectModel"=dword:00000000
"ttidLogObjectModelAddins"=dword:00000000
This is based on http://blogs.msdn.com/b/descapa/archive/2006/12/08/debugging-the-onenote-api-enable-logging.aspx but you need to add EnableTextFileLogging ;-).
The logfile is created in %temp%\OneNote.log
For OneNote 2010 change the path in the .reg files to \14.0\ instead of \15.0\

Visual Studio 2012 - Custom prerequisites are not appearing in the Properties > Prerequisites dialog box

I've created my first Office Add-in using Visual Studio. It targets the 4.0 .Net framework and was created using the new VS 2012. I need to distribute/install this project on various 32-bit XP and 64-bit Windows 7 computers around the office. So I configured the project to be installed on XP (which was my first speed bump because I didn't realize VS 2012 needed an update in order to make a solution that was XP compatible). Now that I have a valid win32 application, I am getting another error:
The following error occurred attempting to install 'C:\filepath...\Import Contacts.vsto':
"No application is associated with the specified file for this operation."
After doing some digging, I think I need to install the Microsoft Visual Studio Tools for Office Runtime on the client computer. To do this, I would like to use the prerequisites properties for the project. So I read up on creating custom prerequisites using some noteworthy sites (e.g, Creating Bootstrapper Packages, Application Deployment Prerequisites, Adding Custom Prerequisites, and Creating a Bootstrapper package for Office 2013 in Visual Studio 2012). I created the files according to that last URL (even though I'm not sure it pertains to the package I need just yet), but it is not appearing in the dialog box under Project > Properties > Publish > Prerequisites
If you read the article, it says the VS prerequisites dialog box should automatically update once I restart VS 2012, which I did but to no avail. I know I'll need to use this feature again in the future, so I would really like to know what I'm doing wrong and fix this. Please help! And I promise to quickly give the ACCEPT to whoever helps me fix this problem! Thank you in advance.
I didn't have any problems following the directions given in the web page and got the bootstrapper added to the Prerequisites dialog. However, there are plenty of possible ways to get it wrong. Some possibilities:
Triple-check the folder you added these files to. Be sure that you picked Program Files (x86) on a 64-bit version of Windows and not Program Files. And be sure that you now see the added VSTOR40 folder along with the other existing bootstrapper folders, like ReportViewer and VBPowerPacks.
You do not have write permission to this folder, UAC prevents copying files there. Be sure that you managed to copy them from, say, an elevated command prompt. Right-click the Command Prompt shortcut and click "Run as Administrator".
If you created the .xml files with Notepad then make sure you didn't accidentally saved them with the .txt extension. If necessary, put Explorer in "programmer mode" so you can see the filename extensions. Control Panel + Folder Options, View tab, untick the "Hide extensions for known file types" checkbox. If you now see product.xml.txt then rename the file to product.xml, same for package.xml.txt
If you created the .xml files with Notepad then be sure to save the file in UTF-8 encoding. File + Save As, Encoding combobox.
For all those who still may face similar issue I think that I found the cause of this issue. It seems that copying folder with custom bootstrapper package (and all necessary files in it) does not "refreshes" the list of available packages. Only when i went through this walkthrough and manually created folder in %Programfiles%\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\ for sample package from this walkthrough my package has shown