Excel Addin does not compile properly on different machines - c#

I have a very old Visual Studio Excel AddIn project.
When I compile it on my machine on VS2013 (.Net 4.0) and Office 2010 it works perfectly on the other machines. But when I compile it on TFS machine (no Office, only the vsto_redist.exe) it does not work - it does not load.
I've tried to switch on the VSTO_LOGALERTS and VSTO_SUPPRESSDISPLAYALERTS but this did not show any errors.
I've also tried to add a Microsoft.Office.Interop.Excel.dll to the project it still does not worked.
Any help on how I can see the problem will be helpful.

You need to install at lest the Excel developer tools that cinder in the box with office.

Related

Word VSTO Add-In on Visual Studio. Why can't I open the Ribbon Visual Designer?

On computer "A", I successfully developed a Word VSTO Add-In using VS 2019 Enterprise using C#. Recently, I rebuilt the hard disk on computer "A". Reinstalled Windows 10 (version 1909). Reinstalled Visual Studio 2019 Enterprise (currently 16.5.5) including the Office/Sharepoint development workload.
On the rebuilt computer "A", I created a new VSTO Word Add-In project. Added a Ribbon (Visual Designer) to the project using this guide: Ribbon Designer
When I attempt to open the designer for the Ribbon I get a no-information error message:
No errors in the error list.
When I attempt to open the ribbon designer on the original, working VSTO add-in, same thing happens.
I have computer "B" that is configured the same as was computer "A" before I rebuilt computer "A". On computer "B", I'm able to open the ribbon designer successfully for both a new VSTO project and my original VSTO project. I compared computer "A" references to computer "B" reference and they look the same
Also verified that Office Runtime is installed
I assume I'm missing a reference. Anyone experience this? Any ideas?
Other things I tried: deleting \bin. Cleaned, rebuilt solution
I guess it will be a mystery. I ended up rebuilding the machine a second time. The only difference was that the second time around I installed Office 2016 instead of Office 2019. I was able to open the ribbon designer just fine this time around

Microsoft.Office.Interop error even after installing PIAs

We have a large project which builds fine on several machines. I am in the process of installing a development system on a new machine and have a problem building because the Microsoft.Office.Interop namespace is missing.
I have Office 2010 installed and have installed the PIAs. I have removed/re-added the Office references in the project - they still seem to have the yellow triangle.
Still no luck.
Could there be anything I haven't tried yet?
Sounds like you're doing something wrong while adding the reference. You could see to these similar threads if they are of help:
https://stackoverflow.com/a/16054365/1493524
PIA's Installed but still receiving interop error
Adding Office 2010 Interop (PIA) in Visual Studio 2012

VSTO 2012: backward compatibility

Since lately the Visual Studio Tools For Office 2012 (VSTO 2012) are available for download.
Can this new version still used for developing Add-In solutions for older Office versions (2007,2010)? Are there any advantages over VSTO 4.0 (besides Office 2013 support)
Yes, it can. I'm using VS2012 for an Excel 2007 project and it works fine.
The trick is to change the debug path in your project file so that VS uses the older version of the Office app your plugin is for.
Create your VSTO project (let VS create the project for Office 2010)
Edit the project file and find the <ProjectProperties> with a HostName attribute. It will be a child element of a <VisualStudio> element.
Change the DebuginfoExeName attribute value of the <ProjectProperties> attribute to be the path to the older version of the Office application .exe file
Save your project
Now when you go to debug your app it should launch the older version of your Office app and attach to that process to load your VSTO.
In my project, the new <ProjectProperties> element looks like this for Excel 2007:
<ProjectProperties
HostName="Excel"
HostPackage="{20A848B8-E01F-4801-962E-25DB0FF57389}" OfficeVersion="14.0"
VstxVersion="4.0"
ApplicationType="Excel"
Language="cs"
TemplatesPath=""
DebugInfoExeName="#Software\Microsoft\Office\12.0\Excel\InstallRoot\Path#excel.exe"
AddItemTemplatesGuid="{51063C3A-E220-4D12-8922-BDA915ACD783}" />
Deployment also works fine. I deploy my add-in via ClickOnce and it is added to Excel 2007 clients without any additional changes.
As far i know you can deploy your solution to previous version office. I once developed an add-in for ppt 2013 and it worked fine in ppt 2010. Note that The API for the new VSTO has several additional features and last time i only used existing features, but not the new ones.
I've never tested this, but i think if you use new event handler that only works in 2013, when you deploy it in 2010 it simply does nothing / doesn't work.
As i mentioned, the obvious advantage of new VSTO is more features available, for example in ppt 2013, it has event handler when the users do dragging, you should checked them by yourselves. If your solution doesn't need these new features, you can develop it in the previous version of VSTO to make sure the backward compatibility.

Outlook Addin Error: Not loaded. A runtime error occurred during loading of COM add-in

I have created an VSTO Outlook addin. The configuration is as follows:
Visual Studio 2008
Office 2007 Outlook add in (3.5 Framework)
MSI created using Visual Studio Setup Project
Deployed to Office 2010 under windows 7
It works fine on the Dev PC however it fails to load once installed on the test machine. The outlook addin window shows a "Not loaded. A runtime error occurred during loading of COM add-in"
It is my understanding that I should not need to install any PIA as the Office 2007 PIA are part of Office 2010.
So far I have tried the following:
set VSTO_SUPPRESSDISPLAYALERTS however it does not show any messages when it tries to start.
configured Fuslogvw.exe (Assembly Binding Log Viewer) however it is not showing any binding errors.
set VTSO_LOGALERTS and it is logging all alerts however as none are shown this has not helped.
Is there anything I am doing wrong or need to do in addition to make this work?
Make sure you have the VSTO 3.0 Runtime installed on the test machine.
You will also need to install the VSTO 3.0 Runtime Service Pack 1 if you are running Visual Studio 2008 Service Pack 1.
VSTO 4.0 Runtime is not required in your situation because it is used with add-ins created with Visual Studio 2010. Please note that the version of VSTO and runtime generally must agree with the version of Visual Studio used to create the add-in.
ere are a couple of usefull sites (I'm not going to copy and paste their advice on troubleshooting)
http://www.ceptara.com/node/183
http://blogs.msdn.com/b/vsod/archive/2008/04/22/troubleshooting-com-add-in-load-failures.aspx

Unable to load the Excel 2003 Add-in

I'm trying to develop an Excel 2003 Add-in using Visual Studio 2008 (SP1).I didn't add any code expect for the boilerplate code added by Visual Studio.
When I run the application in VS it loads up Excel, but the add-in itself does not work. The "COM Add-Ins" window list the add-in, but it's unchecked. The "Load Behavior" reads as "Not loaded.A runtime error occurred during the loading of the COM Add-in".
VS was unable to catch the exception at load-time even though I've enabled all options under Debug > Exceptions.
I also tried setting up VSTO_SUPPRESSDISPLAYALERTS Environmental variable as mentioned in this MSDN article.Surprisingly that also didn't show me any messages.
I'm running Office 2003 (SP3) under Windows XP.It'll be great if someone can help me.
Thanks.
You'll have to install KB908002. Please see
.NET app.config question
How to select .NET framework version running from Excel?
The installation with VS 2008 is a little more complicated. See here:
Can a .NET Word 2003 add-in be installed outside of the GAC?

Categories

Resources