.NET Deploying Office 2003 Redistributable Primary Interop Assemblies (o2003pia.msi)

我的未来我决定 提交于 2019-12-05 20:10:39

This is probably too little too late, but here's a solution I've done for installing our company's office 2003 and 2007 addins using a small bit of C# code. Maybe it could work for you.

I use the Product Codes for both the o2003pia and the o2007pia installations which are:

2003: {91490409-6000-11D3-8CFE-0150048383C9}

2007: {50120000-1105-0000-0000-0000000FF1CE}

Then, by calling the MSI API you can get the install state for each. Here's an example of finding the 2003:

[DllImport("msi.dll")]
    private static extern MsiInstallState MsiQueryProductState
        (string productGuid);
    [DllImport("msi.dll")]
    private static extern uint MsiGetProductInfo
        (string productGuid, string propertyName, StringBuilder valueBuffer, ref Int32 bufferSize);

    bool IsPia2003Installed()
    {
        MsiInstallState state = MsiQueryProductState("{91490409-6000-11D3-8CFE-0150048383C9}");

        return (state == MsiInstallState.msiInstallStateDefault);
    }

If you're trying to accomplish all of this entirely inside the setup project (I assume you're using Visual Studio?) then you can add a "Windows Installer Search" launch condition that checks for the above mentioned ProductCodes. If it's satisfied you can run a custom action that installs the PIAs.

For more information on this solution I'd suggest starting here here.

Not sure why, but I looked at the O2003PIA.MSI and O2007PIA.MSI, and got the following product codes:

O2003PIAProductCode = "{90409419-0006-3D11-C8EF-10054038389C}"

O2007PIAProductCode = "{00002105-5011-0000-0000-000000F01FEC}"

No answer? Well, it doesn't matter that much - since both 02003pia.msi and o2007pia.msi can be installed multiple times without complaining, it is not that important to check if it is already installed.

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