我已使用 Visual Studio 安装项目来创建 MSI。我在 Orca 中编辑了 MSI,以便在首次打开时通过 DLL 执行自定义操作。当我运行 MSI 时,msiexec
记录以下内容:
MSI (c) (E4:BC) [15:28:14:453]: Doing action: CustomAction1
Action 15:28:14: CustomAction1.
Action start 15:28:14: CustomAction1.
MSI (c) (E4:BC) [15:28:14:453]: Note: 1: 2235 2: 3: ExtendedType 4: SELECT `Action`,`Type`,`Source`,`Target`, NULL, `ExtendedType` FROM `CustomAction` WHERE `Action` = 'CustomAction1'
MSI (c) (E4:BC) [15:28:14:453]: Creating MSIHANDLE (13) of type 790542 for thread 3260
MSI (c) (E4:B4) [15:28:14:453]: Invoking remote custom action. DLL: C:\DOCUME~1\USERNA~1\LOCALS~1\Temp\MSIA3.tmp, Entrypoint: SampleFunction
MSI (c) (E4:B4) [15:28:14:453]: Closing MSIHANDLE (13) of type 790542 for thread 3260
Action ended 15:28:14: CustomAction1. Return value 3.
MSI (c) (E4:BC) [15:28:14:468]: Doing action: FatalErrorForm
Action 15:28:14: FatalErrorForm.
Action start 15:28:14: FatalErrorForm.
MSI (c) (E4:BC) [15:28:14:468]: Note: 1: 2235 2: 3: ExtendedType 4: SELECT `Action`,`Type`,`Source`,`Target`, NULL, `ExtendedType` FROM `CustomAction` WHERE `Action` = 'FatalErrorForm'
然后安装程序向导会显示错误消息:The installer was interrupted before MyProduct could be installed. You need to restart the installer to try again.
自定义 DLL 是用 C++ 编写的。这是源代码:
MyCustomAction.cpp:
// MyCustomAction.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"
BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
return TRUE;
}
UINT __stdcall SampleFunction(MSIHANDLE hModule)
{
//This is the function that is called by the MSI
//It is empty because I just want to check that it can be called without interrupting the installer, then I will add the actual functionality
}
MyCustomAction.def:
; MyCustomAction.def
;
; defines the exported functions which will be available to the MSI engine
LIBRARY "MyCustomAction"
DESCRIPTION 'Custom Action DLL'
EXPORTS
SampleFunction
我msi.lib
在 DLL 的附加依赖项中也有引用。当我目前没有明确告诉它做任何事情时,为什么自定义操作会中断安装?任何帮助,将不胜感激。
更新:
在 Orca 中,自定义操作在Binary
表格中并且是表格中的类型 1 CustomAction
。自定义操作在表格的前后Immediate
发生。IsolateComponents
WelcomeForm
InstallUISequence