What Component IDs should I search for to detect whether the Office 2010 PIA's are Installed

假如想象 提交于 2019-12-06 18:52:46

问题


I'm creating a plug-in for Office 2010 and need to detect on install whether the Office 2010 PIA's are installed.

I have done this for 2003 and 2007 but cannot find the Component ID's for 2010 does anyone know what they are?

thanks, Ed


回答1:


Do a search for the component ID for the PIA (primary interop assembly) applicable to the component of office you need from the list below:

{EA7564AC-C67D-4868-BE5C-26E4FC2223FF}   Excel
{4153F732-D670-4E44-8AB7-500F2B576BDA}   InfoPath
{1D844339-3DAE-413E-BC13-62D6A52816B2}   Outlook
{EECBA6B8-3A62-44AD-99EB-8666265466F9}   PowerPoint
{3EA123B5-6316-452E-9D51-A489E06E2347}   Visio
{8B74A499-37F8-4DEA-B5A0-D72FC501CEFA}   Word
{957A4EC0-E67B-4E86-A383-6AF7270B216A}   Project
{B2279272-3FD2-434D-B94E-E4E0F8561AC4}   Forms 2.0
{011B9112-EBB1-4A6C-86CB-C2FDC9EA7B0E}   Graph
{7102C98C-EF47-4F04-A227-FE33650BF954}   Smart Tag
{64E2917E-AA13-4CA4-BFFE-EA6EDA3AFCB4}   Office Shared

E.g. if you are writing a Word add-in, then you only really need to check for the PIA with the GUID {8B74A499-37F8-4DEA-B5A0-D72FC501CEFA}

From here

Microsoft have recently released the PIAs for 2010 seperately. Available here

If you need to support Office 2013, the component Ids are documented here: Office 2013 PIA component Ids




回答2:


There is no need to install PIA separately or check the version of installed PIA if you target .NET Framework 4 and above. Check this article.

When you compile an add-in project that targets the .NET Framework 4, by default the type information for all the PIA types referenced in the add-in code is embedded in the add-in assembly. At run time, this type information is used to resolve calls to the underlying COM type, rather than relying on type information in the PIAs.

Just check in your project that the reference to Microsoft.Office.Interop.Excel has the correct version and EmbedInteropTypes set to true.



来源:https://stackoverflow.com/questions/2903767/what-component-ids-should-i-search-for-to-detect-whether-the-office-2010-pias-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!