How do I add a reference to many different versions of Outlook's COM object?
With r开发者_JAVA百科egard to this question, how do I make VS2010 call the Outlook COM object regardless of DLL version?
Must I have each version of Outlook installed on my machine to reference different versions of the DLL's? I don't think that's technically possible since only one version of Outlook may be installed at a time.
If you're using .NET 4, I suggest you use "No PIA" - go to the Properties for the reference, and enable "Embed Interop Types". So long as you only use the bits of the COM API which are present on any particular machine, you shouldn't need to worry about the exact version. (At least, that's what I've been led to believe :)
There are lots of blog posts about this, including this one by Dino Esposito.
Writing Automation clients for multiple Office versions
精彩评论