向项目中添加新的自定义操作会阻止运行现有的自定义操作 [英] Adding a new Custom Action to a project prevents an existing Custom Action from being run

查看:99
本文介绍了向项目中添加新的自定义操作会阻止运行现有的自定义操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Custom Action项目,该项目具有由我的公司创建的安装程序使用的各种CA,其中一些用于通过Microsoft.Web.Administration API操纵IIs7。

I have a Custom Action project that has various CA's used by installers that my company creates, a few of those are used to manipulate the IIs7 through the Microsoft.Web.Administration API.

我添加了一个名为SetApplicationAutoStart的新自定义动作,该动作包含与IIs相关的CA。此自定义操作用于设置autoStart属性,该属性强制II进行预加载并启动WCF服务,以便缩短初始响应时间。

I added a new custom action called SetApplicationAutoStart the the class containing IIs related CA's. This custom action is used to set the autoStart attribute that forces the IIs to preload and start WCF services so that initial response time will be shorter.

在添加此操作后,现有的名为SetAppPoolLoadUserProfileTrue的CA停止工作。即使计算机上的默认站点已更改,因此此CA也会强制将站点上的该设置设置为true,从而使该设置为false,因此我们确实需要它起作用。

After adding this action an existing CA called SetAppPoolLoadUserProfileTrue stopped working. This CA forces that setting on a site to true, even if the default site on the computer has been changed so that this setting is false, so we really need it to work.

操作失败时,日志文件包含以下几行。

The log files contains the following lines when the action fails.

MSI (s) (A0:18) [15:02:43:639]: Executing op: ActionStart(Name=SetAppPoolLoadUserProfileTrue,,)
Action 15:02:43: SetAppPoolLoadUserProfileTrue. 
MSI (s) (A0:18) [15:02:43:641]: Executing op: CustomActionSchedule(Action=SetAppPoolLoadUserProfileTrue,ActionType=3073,Source=BinaryData,Target=SetAppPoolLoadUserProfileTrue,CustomActionData=AppPoolName=xxxxx)
MSI (s) (A0:18) [15:02:43:670]: Creating MSIHANDLE (377) of type 790536 for thread 50712
MSI (s) (A0:C8) [15:02:43:670]: Invoking remote custom action. DLL: C:\Windows\Installer\MSIBD82.tmp, Entrypoint: SetAppPoolLoadUserProfileTrue
CustomAction SetAppPoolLoadUserProfileTrue returned actual error code 1154 (note this may not be 100% accurate if translation happened inside sandbox)
MSI (s) (A0:C8) [15:02:43:673]: Closing MSIHANDLE (377) of type 790536 for thread 50712
MSI (s) (A0:18) [15:02:43:674]: Note: 1: 1723 2: SetAppPoolLoadUserProfileTrue 3: SetAppPoolLoadUserProfileTrue 4: C:\Windows\Installer\MSIBD82.tmp 
Error 1723. There is a problem with this Windows Installer package. A DLL required for this install to complete could not be run. Contact your support personnel or package vendor.  Action SetAppPoolLoadUserProfileTrue, entry: SetAppPoolLoadUserProfileTrue, library: C:\Windows\Installer\MSIBD82.tmp 
MSI (s) (A0:18) [15:20:25:139]: Product: xxxxxxx -- Error 1723. There is a problem with this Windows Installer package. A DLL required for this install to complete could not be run. Contact your support personnel or package vendor.  Action SetAppPoolLoadUserProfileTrue, entry: SetAppPoolLoadUserProfileTrue, library: C:\Windows\Installer\MSIBD82.tmp 
Action ended 15:20:25: InstallFinalize. Return value 3.

这似乎是从PE提取dotnet PE来执行此操作的问题。

This looks like a problem extracting the dotnet PE from the PE for this action. All other CA's in the binary work properly including the new one.

推荐答案

同一件事发生在我身上。 galets已经指向正确的方向,使我步入正轨(没有回复upvote,对不起)。

Same thing happened to me. "galets" was already pointing in the right direction, setting me on track (no rep to upvote, sorry).

简短版本:

MakeSfxCA生成的本机dll不遵循导致观察到的行为的PE / COFF规范。

MakeSfxCA produces native dlls not following the PE / COFF spec leading to the observed behaviour.

长版:


  1. 构造一个CA,例如 HavocAction具有三个导出的入口点(即标记有 CustomAction属性),分别名为 HavocEntryPointa, HavocEntryPointB, HavocZappEntryPoint(请注意确切的拼写)。这些方法可能只返回 ActionResult.Success。

  2. 使用简单的设置进行操作,a)仅调用 HavocEntryPointa,b)仅调用 HavocEntryPointB

  3. ==>安装程序 a)将起作用,安装程序 b)将失败

  4. 取消注释 HavocZappEntryPoint上的 CustomAction属性,并且行为被反转,即

  5. ==>安装程序 a)将失败,安装程序 b)将起作用

  1. Construct a CA, e.g. "HavocAction", having three exported entry points (i.e. marked with "CustomAction" attribute), named "HavocEntryPointa", "HavocEntryPointB", "HavocZappEntryPoint" (mind the exact spelling). The methods may just return "ActionResult.Success".
  2. Come up with simple setups, a) invoking just "HavocEntryPointa", b) invoking just "HavocEntryPointB"
  3. ==> Setup "a)" will work, Setup "b)" will fail
  4. Uncomment the "CustomAction" attribute on "HavocZappEntryPoint" and the behaviour is inverted, i.e.
  5. ==> Setup "a)" will fail, Setup "b)" will work

进一步分析

当您使用

dumpbin / Exports HavocAction转储包装的CA.dll文件时。 CA.dll

dumpbin /Exports HavocAction.CA.dll

您会得到类似(摘录)的内容

you get something like (excerpt)

125   7C 00003A36 
126   7D 00003A4C HavocEntryPointa
127   7E 00003A62 HavocEntryPointB
128   7F 00003A78 HavocZappEntryPoint
129   80 000042FC zzzEmbeddedUIHandler
130   81 000043B8 zzzInitializeEmbeddedUI
131   82 0000467F zzzShutdownEmbeddedUI
132   83 00003AA5 zzzzInvokeManagedCustomActionOutOfProcW

这是错误的(搜索 pecoff_v83.docx,请参见导出的DLL函数未按词法排序?)。从DLL加载方法时,应该对这些条目进行排序(按ASCII)以便进行二进制搜索(条目 HavocEntryPointa和 HavocEntryPointB互换)。

This is wrong (search for "pecoff_v83.docx", cf. Exported DLL functions not ordered lexically?). The entries are supposed to be sorted (by ASCII) in order to do a binary search when loading methods from the dll (the entries "HavocEntryPointa" and "HavocEntryPointB" are interchanged).

我有根据的猜测是,当从dll加载代码时,二进制搜索失败,从而导致错误。由于二分查找的性质,删除 HavocZappEntryPoint会反转效果。

My educated guess is, when loading code from the dll the binary search fails, resulting in the error. Due to the nature of a binary search, removing "HavocZappEntryPoint" inverts the effect.

关于OP的注释

Kjartan首先使用 SetApplicationAutoStart和 SetAppPoolLoadUserProfileTrue,由于顺序错误,它们未正确导出到CA.dll。大写字母 P在小写字母 l之前,但是由MakeSfxCA互换。他后一种选择 ConfigureApplicationAutoStart和 SetAppPoolLoadUserProfileTrue的订购符合PE / COFF规范。

Kjartan first used "SetApplicationAutoStart" and "SetAppPoolLoadUserProfileTrue" which was not correctly exported to the CA.dll due to wrong ordering; the upper case letter "P" comes before the lower case "l" but this was interchanged by MakeSfxCA. His latter choice "ConfigureApplicationAutoStart" and "SetAppPoolLoadUserProfileTrue" is ordered conforming to the PE / COFF spec.

PS:这是 http://wixtoolset.org/issues/4502 现在。

更新

PPS:从WiX 3.9 RC3版本开始,其中包含针对此问题的错误修复;一切都会按预期进行。

PPS: Starting with the WiX 3.9 RC3 release the bug fix for this issue is included; everything works as expected.

这篇关于向项目中添加新的自定义操作会阻止运行现有的自定义操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆