I am currently working on an Excel 2010 add-in which formerly was an Excel 2007 add-in.
Somewhere in the process of switching computers, the add-in was converted i think.
Some of my customers stated that the add-in wasn't working on Excel 2007 anymore so I tried to debug it in a VirtualBox with Excel 2007 and Visual Studio 2010 installed.
Now I get the Error Message:
You cannot debug or run this project, because the required version of the Microsft Office application is not installed.
I started a new Excel 2007 add-in project and tried to find what the differences are and came up with the idea that it somewhat has to do with the dll's so I changed my 2010 addin until it looked like an 2007 addin.
I still get the error message stating that my project can't be debugged.
Is there anything I could've forgotten to change.
Writing a completely new addin is unfortunately not an option.
These questions haven't helped me so far:
Excel Addin that works on Excel 2007 and 2010
Deploying Office 2010 addin
To get VS 2010 working with Office 2007 modify the project file (.csproj) so that it will open in Office 2007 and not look for Office 2010 when run (hence the error message above).
Here is the project settings change (Excel example):
Source XPath:
//Project/ProjectExtensions/VisualStudio/FlavorProperties/ProjectProperties/#DebugInfoExeName
Old Value (Office 2010):
DebugInfoExeName="#Software\Microsoft\Office\14.0\Excel\InstallRoot\Path#excel.exe"
New Value (Office 2007):
DebugInfoExeName="#Software\Microsoft\Office\12.0\Excel\InstallRoot
\Path#excel.exe"
After changing this project setting, when you fire up the debugger (F5) it will load the Excel 2007 application instead of looking for Excel 2010.
Typically, when I am developing against multiple versions of Office with VSTO Add-ins, I have a project for each version of Office I am targeting. I put all common code between the projects into a single project (typically the oldest project) and use linked files, I add the common files to the newer projects. This allows me to write one set of common core code, abstracted from the requirements of each version of Office. This means I am no longer fighting the different ways VSTO is compiled for each version of Office. This can be made easier with shared folders and virtual machines, so I can develop and test without multiple computers. It is by no means graceful, but it works well for me. This should allow you to develop your VSTO Add-in against both Office 2007 and Office 2010 without much issue.
Related
I am developing an Excel 2010 VSTO project - my deploy machines have Excel2010 setup which can't be upgraded (production machines).
My development machine has Excel 2013 (again, due to IT I can't downgrade it to Excel 2010).
How can i develop such a project?
Trying to run the Excel 2010 VSTO project (from VS, either release or Debug) gives me an error message...
You cannot debug or run this project, because the required version of the Microsoft Office application is not installed.
and after clicking OK, i receive:
Unable to start debugging. Operation not supported. Unknown error: 0x80070057.
It is possible to develop a VSTO project against a later version of Office than that installed on the target systems. In order to do so, the project must base on .NET Framework 4 or later. Choose the project template for the version of Office installed on the development machine.
Set "Embed interop types" to True for all the Office libraries referenced in the project. This will make the object libraries version-independent.
It's also important to not use any functionality introduced after the earliest version of Office being targeted. If the code tries to use functionality introduced in Excel 2013, for example, this code cannot run in Excel 2010.
For more information see https://learn.microsoft.com/en-us/visualstudio/vsto/running-solutions-in-different-versions-of-microsoft-office?view=vs-2017 and https://learn.microsoft.com/en-us/visualstudio/vsto/designing-and-creating-office-solutions?view=vs-2017
I have used Shared Add In(C#) to develop an Excel Add-In. In the initialization, I had no problem with loading excel-dna file .xll on Office 2010. However, there is problem with running on either Office 2013 or 2016, showing that "function is Invalid".
AddIn udfAddIn = applicationObject.AddIns.Add(progID, true);//the exception is "AddIns is Invalid"
udfAddIn.Installed = load;
Please help me. I would like to know how it (.xll file) works on Office 2013 and 2016 by shared add in. Thanks!
You are mixing two different technologies when you make a Shared add-in (a COM add-in) with Excel-DNA. I'm surprised it worked with Excel 2010.
The best approach is to make a new Class Library project (targeting .Net Framework) and then install the ExcelDna.AddIn package from NuGet. Then follow the instructions in the readme file that pops up. You should have a starter add-in that works in both Excel versions.
The best place for Excel-DNA support is the Google group at https://groups.google.com/forum/m/#!forum/exceldna
I want to create an add-in (a ribbon precisely) for MS Excel by using Visual Studio C# 2010 Express. I have searched and read about it here and here and somewhere else. However, when I want to create a new project I don't see any template as described, I don't see even the Office tab. Is it because I am using the Express edition? I think it shouldn't be. Because in this official comparison they say all editions are capable of office development.
What can I do to develop this add-in?
According to this post on the MSDN forum, Visual Studio Tools for Office are not available in the Express edition. I'm not sure where you're reading that on the comparison page (a quick glance said nothing about the Express edition).
A good alternative to VSTO for making an Excel add-in with .NET is Excel-DNA (which I develop). It is a free library that integrates your .NET assembly with Excel using the C API (as an .xll add-in). You can create user-defined worksheet functions (UDFs) for Excel (which are not supported by VSTO), and make ribbons, RTD servers. And you get easy deployment (a single .xll file) without needing any registration or admin rights, even for ribbons and RTD servers.
Another option, if you just want to integrate through the COM interface and not make UDFs or use the specialized Excel features, is NetOffice. The project give you a version-independent set of interop assemblies for Office and Visio, and allows you to easily make add-ins targeting different versions of Office. NetOffice can also be used as your COM interop library in an Excel-DNA add-in.
Both of these directions will work fine under the Express editions of Visual Studio, as well as in the free SharpDevelop IDE.
I'm still confused by the different versions of VSTO and in which way they are compatible to office 2007/2010. I know there is a nice table for comparisons on wikipedia, but I still don't get it. My focus lies on PowerPoint.
Okay, so I have the Visual Studio 2010 Professional Edition that provides two templates for PowerPoint: a 2007 Add-In template and a 2010 Add-In template. What exactly is the difference here, is it just the version of the underlying VSTO? Apart form that, is there a difference between VSTO 4.0 and VSTO 2010? Wikipedia uses both terms.
I want the Add-In to work with both PowerPoint 2007 and 2010. Should I chose the 2007 Add-in project type or the 2010 add-in project type?
Wikipedia says: "Office 2007 applications can also use the VSTO 2010 runtime"
and it also says
"VSTO solutions developed against newer Office versions will not work in older Office versions as they lack the necessary Primary Interop Assemblies (PIAs)".
Isn't that some kind of contradiction?
below image should be helpful
A VSTO project will work only with the selected version and later i.e. a 2007 add-in will work with Office 2007 and 2010, whereas a 2010 add-in will work with only 2010.
When deciding which version to choose for an add-in, choose the version of the oldest Office version you want to support.
I am using Visual Studio 2010 to create a new add-in for Excel. Ideally I would like it to work with Excel 2011 (Mac), 2010, and 2007.
There are three template options to choose from when I start a new C# project.
(Office) Excel 2010 Add-in
(Extensibility) Visual Studio Add-in
(Extensibility) Shared Add-in
What are the differences between these template choices?
Thanks in advance.
From MS. As the name implies, you probably want to use shared add-in.
Office Excel 2010 Add-in
Creates an application-level add-in for Excel 2007 or Excel 2010. For more information, see Getting Started Programming Application-Level Add-Ins and Excel Solutions.
(Extensibility) Visual Studio Add-in
Visual Studio Add-ins add functionality to the Visual Studio and Visual Studio Macros environments. For more information, see How to: Create an Add-In.
(Extensibility) Shared Add-in
Shared Add-ins can add functionality to one or more Microsoft Office applications, as well as to Visual Studio. For more information, see How to: Create an Add-In.
Reference: http://msdn.microsoft.com/en-us/library/0fyc0azh.aspx
#1 and #3 will work for Windows machines, but straight from Geoff Darst of Microsoft's VSTO team, "the .Net Development Platform and Visual Studio Tools For Office are Windows only." You'll have to code in VBA to get functionality across all three versions.
If you want to target just the Windows environment, make sure you target the 2007 version of Excel, as I don't believe solutions developed for Excel 2010 are backward compatible with Excel 2007.