Olivier Jaquemet
Guest
|
Hi,
There are several articles, blogs and videos about Office Interop and PIA :
They all seem to imply that the target office version is choosen when the add-in project is created.
But
- how do I check the target version of an existing add-in express project ? Specifically what are the latest assembly version of the version neutral interop dll provided by Add-in Express ?
- how to I changed the target version of an existing add-in express project ? (from any version to a version neutral, or from version neutral to any specific version)
On a side note : having one article summing up all the *up to date* information of all blog post above would be appreciated. |
|
Andrei Smolin
Add-in Express team
Posts: 19175
Joined: 2006-05-11
|
Hello Olivier,
To find interops in your add-in project, open the References secton. If the interop name is "Interop.{application}.dll", this is an Add-in Express interop for the earliest avaiable version of the {application}; most often this is version 2000. If the interop name is different, click it and see the Version property in the Properties window.
Replacing interops may require setting correct references. Also, there's a difference between
Note that interops for your project are located in the Interops subfolder. You can replace them with interops for another Office version from {Add-in Express installation folder}\Redistributables\Interop Assemblies. It is recommended that all Office interops in your project are for the same Office version.
Also, typically, you can remove the interop for VBE. It is required only if you create VBA macros programmatically.
Olivier Jaquemet writes:
how to I changed the target version of an existing add-in express project ?
The "target Office version" is an incorrect term. As explained in http://www.add-in-express.com/creating-addins-blog/2010/03/16/interop-assemblies-late-binding/ registering an add-in on a machine means that whatever Office version is installed on that machine, it will load the add-in. You can bypass this as explained in http://www.add-in-express.com/creating-addins-blog/2012/01/20/load-office-addin-on-condition/
Olivier Jaquemet writes:
Specifically what are the latest assembly version of the version neutral interop dll provided by Add-in Express ?
I'm not sure that I understand you. You can find all 19 interop assemblies in this folder:
{Add-in Express installation folder}\Redistributables\Interop Assemblies\VersionNeutral.
Olivier Jaquemet writes:
On a side note : having one article summing up all the *up to date* information of all blog post above would be appreciated.
Thank you for the suggestion.
Andrei Smolin
Add-in Express Team Leader |
|
Olivier Jaquemet
Guest
|
Olivier Jaquemet writes:
how to I changed the target version of an existing add-in express project ?
The "target Office version" is an incorrect term. As explained in Supporting several Office versions in an add-in. Interop assemblies and late binding. registering an add-in on a machine means that whatever Office version is installed on that machine, it will load the add-in. You can bypass this as explained in How to load your Office COM add-in on condition
Thank you for this clarification, I was a bit lost after reading all those articles :)
Olivier Jaquemet writes:
Specifically what are the latest assembly version of the version neutral interop dll provided by Add-in Express ?
I'm not sure that I understand you. You can find all 19 interop assemblies in this folder:
{Add-in Express installation folder}\Redistributables\Interop Assemblies\VersionNeutral.
I was wondering if the neutral interop dll had evolved in time that maybe I was referencing a old dll. Thus my question regarding their version.
I have the following references in my project :
- Interop.Excel 1.3.0.0 *
- Interop.Office 2.1.0.0 *
- Interop.PowerPoint 2.6.0.0 *
- Interop.VBIDE 5.3.0.0 *
- Interop.Word 8.1.0.0 *
- Microsoft.Office.Interop.Word 11.0.0.0 **
- Microsoft.Office.Interop.Excel 11.0.0.0 **
- Microsoft.Office.Interop.PowerPoint 11.0.0.0 **
- Microsoft.Vbe.Interop 11.0.0.0 **
- Office 11.0.0.0 **
There all indicate a runtime version v1.1.4322
* dll located in my project
** dll located in "Program Files (x86)\Microsoft Visual Studio 9.0\Visual Studio Tools for Office\PIA\Office11\"
I am not really sure which ones are needed as the project was initialy started by someone else which is not in our company anymore :/
I need to stay compatible with word/excel/powerpoint in all Office version above 2003.
I don't think we provide any VBA macros.
I don't think we use any feature specific to a more recent version of Office (we mostly provide a task pane).
Do you see anything that would need an update or could be removed ?
If I make any change, will they be verified at build time or is there a risk my project could crash at runtime ?
Thanks for your help, this is really appreciated! |
|
Andrei Smolin
Add-in Express team
Posts: 19175
Joined: 2006-05-11
|
Olivier Jaquemet writes:
I was wondering if the neutral interop dll had evolved in time that maybe I was referencing a old dll. Thus my question regarding their version.
Then I would recommend replacing them in the Interops folder with the corresponding files from {Add-in Express installation folder}\Redistributables\Interop Assemblies\VersionNeutral.
Olivier Jaquemet writes:
I am not really sure which ones are needed as the project was initialy started by someone else which is not in our company anymore
If your add-in doesn't need to support Office 2000-2002, then the interops below are not required:
- Interop.Excel 1.3.0.0 *
- Interop.Office 2.1.0.0 *
- Interop.PowerPoint 2.6.0.0 *
- Interop.VBIDE 5.3.0.0 *
- Interop.Word 8.1.0.0 *
After you delete them VS will complain about a number of compile errors. Try modifying/adding using's (Imports' in VB) so that to solve these errors. Say, the add-in module doesn't contain Office-related using (Imports in VB) clauses if you choose version-neutral interops. But if you choose to use an interop for Excel 2002-2013, the add-in module contains this using:
using Excel = Microsoft.Office.Interop.Exce;
This allows the following exemplary code line to compile with version-neutral and with Microsoft's interops:
Excel.Range myRange = null;
Hope this helps.
Andrei Smolin
Add-in Express Team Leader |
|
Olivier Jaquemet
Guest
|
Thank you Andrei. I'll have a look at all this and try your different suggestions. |
|