在Visual Studio 2008中使用自定义安装程序时出现错误1001

Tea*_*ild 7 custom-action visual-studio-2008

我创建了一个简单的winforms应用程序和一个自定义安装程序.这看起来很简单,但我在事件日志中得到以下弹出窗口和错误详细信息.

运行自定义操作代码之前显示错误消息框

无法找到源MsiInstaller的事件ID 11001的描述.引发此事件的组件未安装在本地计算机上,或者安装已损坏.您可以在本地计算机上安装或修复该组件.

如果事件源自另一台计算机,则必须随事件一起保存显示信息.

活动中包含以下信息:

产品:自定义操作测试程序 - 错误1001.错误1001.初始化安装时发生异常:System.IO.FileNotFoundException:无法加载文件或程序集'file:/// C:\ Windows\system32\Action'或其中一个它的依赖关系.系统找不到指定的文件..(NULL)(NULL)(NULL)(NULL)(NULL)

消息资源存在但在字符串/消息表中找不到该消息

我检查了C:\ Windows\system32,没有名为Action的文件或文件夹,但有3个文件叫做ActionCenter.dll,ActionCenterCPL.dllActionQueue.dll

我有什么想法解决这个错误?

编辑:

根据cosmin-pirvu的建议,我使用日志记录运行安装程序.它出现错误的区域如下所示,但我仍然不知道如何解决问题.

MSI (s) (40:7C) [09:34:26:523]: Executing op: CustomActionSchedule(Action=_FBC0CC84_D5B4_41F9_A3EC_98A13BC7E73E.install,ActionType=3073,Source=BinaryData,Target=ManagedInstall,CustomActionData=/installtype=notransaction /action=install /LogFile= /targetdir="C:\Test\Custom Action Tester\" /Param1="C:\Test\TestFile.txt" /Param2="C:\Test\" "C:\Test\Custom Action Tester\ConfigSetup.dll" "C:\Users\wildb\AppData\Local\Temp\CFG66BE.tmp")
MSI (s) (40:94) [09:34:26:525]: Invoking remote custom action. DLL: C:\Windows\Installer\MSI85A8.tmp, Entrypoint: ManagedInstall
MSI (s) (40:F0) [09:34:26:525]: Generating random cookie.
MSI (s) (40:F0) [09:34:26:557]: Created Custom Action Server with PID 6492 (0x195C).
MSI (s) (40:D4) [09:34:26:586]: Running as a service.
MSI (s) (40:D4) [09:34:26:587]: Hello, I'm your 32bit Elevated custom action server.
DEBUG: Error 2835:  The control ErrorIcon was not found on dialog ErrorDialog
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2835. The arguments are: ErrorIcon, ErrorDialog, 
Error 1001. Error 1001. Exception occurred while initializing the installation:
System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:\Windows\system32\Action' or one of its dependencies. The system cannot find the file specified..
MSI (s) (40!4C) [09:34:29:580]: 
MSI (s) (40:94) [09:34:29:584]: Leaked MSIHANDLE (14) of type 790531 for thread 7244
MSI (s) (40:94) [09:34:29:584]: Note: 1: 2769 2: _FBC0CC84_D5B4_41F9_A3EC_98A13BC7E73E.install 3: 1 
DEBUG: Error 2769:  Custom Action _FBC0CC84_D5B4_41F9_A3EC_98A13BC7E73E.install did not close 1 MSIHANDLEs.
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2769. The arguments are: _FBC0CC84_D5B4_41F9_A3EC_98A13BC7E73E.install, 1, 
CustomAction _FBC0CC84_D5B4_41F9_A3EC_98A13BC7E73E.install returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Action ended 09:34:29: InstallExecute. Return value 3.
Run Code Online (Sandbox Code Playgroud)

这应该是一个快速的胜利,让我们的用户生活更简单; 他们不想编辑配置文件......但它变成了一个噩梦.:O(

编辑2:

经过大量的游戏后,只有在自定义操作中指定参数时,错误才会出现,如图所示.问题是,自定义安装程序无法读取前面安装屏幕中输入的值.

自定义操作属性屏幕

Tea*_*ild 7

经过几个小时的圈子,我终于找到了问题,更重要的是解决方案.

应该可以将参数传递为此博客中定义的"CustomActionData",但参数有点怪,至少可以说......

我发现文本参数不能在参数名称周围加引号,并且应该格式化如下:

/ Param1 = [CONFIG_TESTFILE]/Param2 = [CONFIG_TESTFOLDER]

此外,要使用目标目录参数,您需要包含引号,但不是以反斜杠结束字段,而是必须使用空格,如下所示:

/ target ="[TARGETDIR]"

  • 我建议使用"\"而不是目标空间.您可以轻松地使用此代码来获取正确的路径:string exePath = Path.Combine(Context.Parameters ["targetdir"],"TestForSetup.exe"); var config = ConfigurationManager.OpenExeConfiguration(exePath); (3认同)