Cannot Develop Office 2010 Addin Using VS2013 or VS2015 with Office 365 Installed - vsto

I have Office 2010 installed (and Office 365 as it happens), and am trying to develop an Outlook 2010 Add-in using VS2013 and VB.
I create a new Outlook 2010 Add In. Compile and Run the default app ("ThisAddIn"). Outlook 2010 opens OK. So far so good. Exit Outlook 2010.
Save the OutlookAddIn project.
Close VS2013
Restart VS2013. Try to open the saved project/ .sln and then get a "One Way upgrade" splash screen. Why...????
Tried the "upgrade", and it fails. "One or more projects in the solution were not loaded correctly...etc etc"
Output windows shows: " The application for the project is not installed" (That seems to indicate the solution "thinks" it's looking for an Office version other than Office 2010, I believe)
Solution Explorer window shows "OutlookAddIn1(loading)...The project file will load in the background" and the "One-way upgrade" splash returns.
Cancel that.
Solution Explorer window now shows "OutlookAddIn1(needs migration)...The project file will load in the background".
I try "Reload Project" in solution explorer. It appears to do so.
I try to run the app again, I get a dialog saying " You cannot debug or run this project, because the required version of Microsoft Office application is not installed".
Check Project Properties and ALL references appear to have gone. (?????)
I've reinstalled VS2010 Tools. That didn't work either.
I have tried VS2015 and get exactly the same behavior.
So....... I uninstalled Office 365 completely. That didn't work either.
Any clues please?

I have solved the problem, but don't know for sure what caused it. I suspect there were some corrupted pointers in Windows that were "confusing" Outlook 2016 with Outlook 2010. The only clues I had to this were that in the Control Panel>Default Items>Set Your Default Programs, the default app for mail was shown as Outlook 2016, but its associated description was all about Outlook 2010.
So I did a complete uninstall of Office 365 (Office 2016) followed by a complete uninstall of Office 2010. I then cleaned out as many registry entries and folders associated with those as I could.
I then reinstalled Office 365, followed by Office 2010. Now I can develop an Outlook 2010 app in VS2013 or 2015 as normal. So the problem is apparently solved without knowing its cause.

Related

VSTO Addin for Outlook won't work

I've seen tons of posts and sites that address this issue. I've tried every solution I've found but none of them work (I've been trying to figure this out for days now). I have seen many posts with the same exact sounding issue, but either the solution didn't work for me or isn't applicable. With that said...
I have an add-in for Outlook 2007 that is intended to add text to the an email's title and body. It is installed for all users using an .msi file. There is an older version that I deployed last year that works fine. The new version I created has only a few minor input/output changes, nothing major. This new version works perfectly on my development computer in both debug from Visual Studio and from an actual install. However, I can't get it to work on a non-development computer. Here are the details on the program and target computer (development computer and target computer details are the same other than the fact that the target computer doesn't have Visual Studio):
-Using Visual Studio Professional 2013
-Written in Visual Basic
-Target Framework is .NET 4.0
-The add-in is only run once the "send" button on an email is clicked.
-Outlook version is Outlook 2007
-Operating system is Windows 7 Enterprise SP1 32-bit
The problem is that the add-in won't load on the target computer(yes, I know, a bazillion other people have had the same issue). As I said previously, it works fine on my computer in both debug and installed versions. This made me think that the other computer is missing something, so I tried installing the .NET 4.0 framework onto the target computer but it told me that it was already installed. I ran through everything I could think of to get it to work with no avail. Here's how it behaves:
-Installs fine with no errors.
-HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Office/Outlook/Addins/EmailMarkTool/LoadBehavior = 3 after installation.
-VSTO_LOGALERTS = 1
-VSTO_SUPPRESSDISPLAYALERTS = 0
-Outlook opens with no apparent errors.
-LoadBehavior = 0 immediately after Outlook is opened.
-Shows up in the Add-ins under "Inactive Application Add-ins."
-Never shows up under "Disabled Add-ins."
-In the "COM Add-Ins" dialog where I can check which add-ins to use, it shows the correct directory and the Load Behavior is "Unloaded."
-The add-in can be checked. When I click "OK" I don't get any errors. When I go back to the Add-ins, it is unchecked and "Unloaded" again.
-Setting the LoadBehavior to 3 doesn't help because it goes back to 0 as soon as Outlook is started again.
-I inserted a try-catch block into the New() function of the add-in that has a MsgBox pop-up and a Throw.
-I get absolutely no errors anywhere.
-No log file is generated.
I have tried uninstalling, rebuilding, and reinstalling multiple times all with the same result. I just can't figure out why it will work on my development computer but not the target computer. Thanks for reading all of this. I know it's a lot, but I needed to get the details out. Thanks in advance for any input!
[UPDATE]: I just created a brand new minimal add-in just to test if it would work but got the same results.
I found the problem!
The problem may be unique to Outlook 2007. It turns out Microsoft Office 2007 SP1 and SP2 had a bug that prevented it from running VSTO addins. Microsoft released a hotfix that fixes this issue (https://support.microsoft.com/en-us/kb/976477). This was added in to the release of Microsoft Office SP3. However, to activate the fix, a new registry flag must be created but that isn't automatically done with the fix, making the fix useless until you manually activate it (instructions and download here). So...
To enable VSTO addins in Outlook 2007, you have to add a subkey to this registry: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\12.0\Common\General\
and add a DWORD "EnableLocalMachineVSTO" with the value set to 1.
I did this, restarted the computer for good measure, installed my addin for the 23rd time, and it installed and ran perfectly! I'm not sure how previous versions worked, though. It's possible that our system admins removed that subkey in an effort to bolster security at some point.
The loadbehaviour key problem you are experiencing is strange. Whilst I think this is probably not your solution, it could be, so its worth a try.
The target computer will need to have VSTO tools for office runtime installed.
You can download these tools are the following link - https://www.microsoft.com/en-GB/download/details.aspx?id=48217

Adding Office 2010 Interop (PIA) in Visual Studio 2012

I am writing an application in VB.NET that will send emails using outlook. My problem is that I need the Office 2010 PIA to do this. The following are the steps I have already tried (I am using Visual Studio Express 2012):
Restarted the machine
Downloaded Office 2010 PIARedist and installed it
Restarted Visual Studio
Restarted the machine again
Uninstalled Office and the PIA and re-installed Office, making sure that the PIA was selected in the installation options (it was already selected by default, so presumably I installed it the first time I installed Office as well).
Restarted the machine again
Downloaded Office 2010 PIARedist and installed it again
Restarted VS
After each of these steps, the PIA is still not available in "Add Reference" in VS, nor do the files exist on my computer at all (a search for "Microsoft.Office.Interop.Outlook.dll" confirms this). I am running Windows 7 on my MacBook Pro. Does anyone know what my problem is here? This seems like a ridiculous amount of headache for such a simple feature.
PS The only reason I need the PIA is to be able to add CC recipients on the email. That's it. If anyone knows how to do that without the PIA, please let me know because I'd much rather just do that and be done with it.
PSS Both times when I installed the PIA itself, the installation ended silently (no indication of success or failure).
In case anyone stumbles on this question, I finally figured out how to add the interop. For some reason, it won't show up in the "Add References" window (maybe it's because I have VS2012 (11.0) and I'm using Office 2010...?) Anyway, I had to manually browse to it to add it. It was located in C:\Windows\assembly (all of the Office 2010 interops were in there). Also interesting was that a search of the entire C drive for 'Microsoft.Office.Interop.Outlook' or shortened versions of that string turned up absolutely no results, even though they are on the drive. One last note: although 'Microsoft Office 14.0 Object Library' shows up in the "Add References" window, adding that reference did not allow access to the interop.

Building/deploying a simple Word addin

I am trying to build a simple addin for Word 2007 using Visual Studio 2010 and .NET 4.0. It's a relatively simple addin, which brings up a save dialog and saves the document as a Word 2003 document.
The addin runs fine in Word under Debug mode, but does not run under Release or when I create a setup project for it. (It does create the registry keys under HKCU\Software\Microsoft\Office\Word\Addins and they look to be correct) I don't get any errors, and the addin isn't listed under the Disabled Addins either.
I tried adding the Addin manually but it says that it isn't a valid addin. The version of Office is 32-bit, running under Windows 7 64-bit.
Or are there even any alternatives to using VSTO (VBA?) that will let me add a tab to the Ribbon?
You can use IRibbonExtensibility interface (http://msdn.microsoft.com/en-us/library/microsoft.office.core.iribbonextensibility.aspx) to avoid using VSTO.

Visual Studio 2010, Office 2007 & 2010 Interopability

On my development PC, I uninstalled Office 2007 and installed Office 2010.
I have a VS 2010 Solution that has several Excel 2007 templates (projects).
When I open the Solution, VS wants to "upgrade" the project (to Office 2010). I cancelled out of that and in the VS options, I turned off "Upgrade to latest version of Office".
Now, the solution opens fine, but the Excel 2007 template projects will not load or open. All the clients that run this appication have Office 2007 intalled, so I need to be able to continue to develop this application and target Office 2007.
Can anyone tell me how to do that? (I downloaded and installed the Office 2007 PIA...)
Thanks!
As a rule I always suggest running the version of office on your development machine that you are targeting, otherwise you loose F5 support and things often don't work as they should.
Another point is that if you do upgrade to Office 2010, the add-in will still work on 2007, as long as you do not access any of the 2010 API's. So technically if you upgrade the project to 2010, then remove the reference to Microsoft.Office.Interop.Excel v14 and add v12, that will restrict you to office 2007 API's, and you shouldn't have a problem.
Just give it a go, upgrade the project, then try install it into Office 2007, it should work fine. If not, just undo/revert your local changes.
I think your problem is VSTO, VSTO 3.5 was office 2007, vsto 4 comes with VS2010 and is Office 2010.
You might check on what versions of VSTO are currently installed and make sure you've got the right ones.

Problem installing VSTO4.0 addin on Outlook 2007

I have created an Outlook addin using VS2010 and VSTO 4.0.
On Windows7+Outlook 2010, the installation and and application behaves as expected.
On Vista+Outlook 2007 (fresh installed virtual machine), the installer complains that it does not recognize the .vsto file format.
Has anyone experienced this? When I previously created VSTO3.0 addins and used them on Outlook 2007 I had no problems with installation.
You need to install the VSTO 4.0 runtime (which comes pre-installed with 2010, but not with 2007). You can download it from Microsoft right here.
If you deploy using ClickOnce this runtime gets added to the prerequisites automatically.