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

百般思念 提交于 2019-12-07 14:08:33

问题


Has anyone out there actually succeeded in creating a prerequisitie for o2003.msi?

There are a lot of people out there asking about this, but I cannot find anyone who actually succeeded. I find some extremely complicated solutions where you are required to comple .cpp-files for which the soure may or may not be supplied. I even tried to complie one of those but got configuration error on the target machine... :-(

If I don't install o2003.msi, my Office "Shared Add-In" will throw an exception because office.dll cannot be found. So I would very much like to have it included in my installer.

And a second question, regardless of the outcome of the previous one: what about a machine with Office 2007? 02203.msi complains that Office 2003 is not installed, so there seems to be a lot of things I need to get done in order to create a working installer for an "Office Shared Add-In"... anyone else going through the same nightmare?

Update: It seems to be the PIA for Office.Core / "office.dll" which is the really thing to get on the traget machine. None of the "complicated" solutions (which I know I can get to work if I put some effort in it) talks how to detect this particular file, just PIAs for Word & Excel and then some. These seems to be in place anyway. It's office.dll that is the important file to check for and install o2003pia.msi if it is not properly installed!


回答1:


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.




回答2:


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}"




回答3:


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.



来源:https://stackoverflow.com/questions/689106/net-deploying-office-2003-redistributable-primary-interop-assemblies-o2003pia

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