1
votes

I'd like to target multiple office/outlook versions in one C# project, specifically Outlook 2010 and upwards. So far I have added a COM Reference in my C# project to Microsoft.Office.Interop.Outlook and Microsoft.Office.Core; this works fine on my dev system which has 2013, but on systems with 2010 it predictably throws an error:

System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Office.Interop.Outlook, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.Office.Interop.Outlook, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'

The API between Office 2010 (v14) and 2013 is broadly compatible for my needs and there shouldn't be a problem of switching between one and the other. Certainly if I had used an interpreted language to load the Outlook COM, there would be no change in code version to version.

I am aware of the NetOffice "wrapper" around a variety of Office versions, but am reluctant to use it if there is a simpler solution using built in tools/approaches.

1
You may eventually find Microsoft's interop solutions are slow and painful, which is the reason why external libraries exist.Parrish Husband

1 Answers

1
votes

Create an interop dll on a machine where lowest version of Outlook that you plan to support is installed, then add a non-version specific reference to that interop dll on your primary dev machine.