简体   繁体   English

.NET部署Office 2003可再发行的主互操作程序集(o2003pia.msi)

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

Has anyone out there actually succeeded in creating a prerequisitie for o2003.msi? 有没有人真的成功地为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. 我找到了一些非常复杂的解决方案,你需要补充.cpp文件,其中可能提供或不提供源。 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. 如果我不安装o2003.msi,我的Office“共享加载项”将抛出异常,因为找不到office.dll。 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? 还有第二个问题,不管前一个问题的结果如何: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? 02203.msi抱怨没有安装Office 2003,所以我需要完成很多工作才能为“Office Shared Add-In”创建一个正常工作的安装程序...其他任何人都要通过它恶梦?

Update: It seems to be the PIA for Office.Core / "office.dll" which is the really thing to get on the traget machine. 更新:它似乎是Office.Core /“office.dll”的PIA,这是在traget机器上真正的东西。 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. 没有一个“复杂”的解决方案(我知道如果我付出一些努力就可以开始工作)会谈到如何检测这个特定的文件,只有PIA用于Word和Excel,然后是一些。 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! 如果没有正确安装,它的office.dll是检查并安装o2003pia.msi的重要文件!

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. 这可能太晚了,但这是我用一小段C#代码安装公司办公室2003和2007插件的解决方案。 Maybe it could work for you. 也许它可以为你工作。

I use the Product Codes for both the o2003pia and the o2007pia installations which are: 我将产品代码用于o2003pia和o2007pia安装,它们是:

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

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

Then, by calling the MSI API you can get the install state for each. 然后,通过调用MSI API,您可以获得每个API的安装状态。 Here's an example of finding the 2003: 这是找到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. 如果你想在安装项目中完全完成所有这些(我假设你正在使用Visual Studio?),那么你可以添加一个“Windows Installer Search”启动条件来检查上面提到的ProductCodes。 If it's satisfied you can run a custom action that installs the PIAs. 如果满意,您可以运行安装PIA的自定义操作。

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: 不知道为什么,但我查看了O2003PIA.MSI和O2007PIA.MSI,并获得了以下产品代码:

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

O2007PIAProductCode = "{00002105-5011-0000-0000-000000F01FEC}" 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. 好吧,没关系我 -因为两者02003pia.msi和o2007pia.msi可以不抱怨多次安装,它不是那么重要的,以检查是否已经安装了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM