0

我正在构建一个托管 DLL,该 DLL 与适当签名的目录一起捆绑在 MSI 中。MSI 安装失败,报告程序集名称、处理器架构等。使用详细日志记录运行 MSIEXEC,显示如下:

MSI (s) (64:DC) [14:31:33:754]:程序集错误:HRESULT 无法转换为相应的 Win32 错误代码。MSI (s) (64:DC) [14:31:33:785]:注意:1:1935 2:{1ADE2A83-E905-4F35-9DD8-61F512CA50E8} 3:0x800736FD 4:IAssemblyCacheItem 5:提交 6:BLAHBLAH, version="10.0.62601.0",type="win32",processorArchitecture="x86",publicKeyToken="5f523ae7e6e1b389" MSI (s) (64:DC) [14:31:33:785]: 装配错误 (sxs):请查看位于 -207342408ndir\logs\cbs\cbs.log 的基于组件的服务日志以获取更多诊断信息。MSI (s) (64:DC) [14:31:33:785]: 注意: 1: 2205 2: 3: 错误 MSI (s) (64:DC) [14:31:33:785]: 注意: 1:2228 2:3:错误 4:MessageError哪里选择Error= 1935 MSI (c) (7C:1C) [14:31:33:785]:字体已创建。Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg Error 1935. 安装程序集 'BLAHBLAH,version="10.0.62601.0",type="win32" 时出错,processorArchitecture="x86",publicKeyToken="5f523ae7e6e1b389"'。有关详细信息,请参阅帮助和支持。HRESULT:0x800736FD。组装接口:IAssemblyCacheItem,功能:Commit,组件:{1ADE2A83-E905-4F35-9DD8-61F512CA50E8} MSI (s) (64:DC) [14:31:48:019]:注:1:2205 2:3:错误 MSI (s) (64:DC) [14:31:48:019]: 注意: 1: 2228 2: 3: 错误 4: SELECT MessageFROM ErrorWHEREError= 1709 MSI (s) (64:DC) [14:31:48:019]:产品:BLAHBLAH v10.0.62601.0 -- 错误 1935。安装程序集 'BLAHBLAH,version="10.0. 62601.0",type="win32",processorArchitecture="x86",publicKeyToken="5f523ae7e6e1b389"'。有关详细信息,请参阅帮助和支持。HRESULT:0x800736FD。组装接口:IAssemblyCacheItem,功能:Commit,组件:{1ADE2A83-E905-4F35-9DD8-61F512CA50E8} 动作结束 14:31:48:InstallFinalize。返回值 3。

查看 Windows/Logs/CBS.log,我可以看到:

2014-10-30 14:31:33,Info CSI 0000000c 执行 1 个操作;1 未锁定/解锁并遵循:安装 (5):标志:0 tlc:[BLAHBLAH,版本 = 10.0.62601.0,pA = PROCESSOR_ARCHITECTURE_INTEL (0),文化中立,VersionScope 中立,PublicKeyToken = {l:8 b:5f523ae7e6e1b389 },类型 = [l:10{5}]"win32",TypeName 中性,PublicKey 中性]) ref:(flgs:00000000 guid:{27dec61e-b43c-4ac8-88db-e209a8242d90} 名称:[l:0]" " ncdata: [l:62{31}]"C:\Windows\system32\msiexec.exe") 指纹:[l:128{64}]"c303b9f117203669bdfdbf904a7f1d45e4767da45615a08eff196fb02d093399" 2014-10-30 14:31:3 错误0000000d@2014/10/30:14:31:33.488 (F) d:\win7sp1_gdr\base\wcp\library\catalog.cpp(263): Error c000038a [Error,Facility=(system),

我看到很多报告指出 HRESULT 0x800736FD 是一个内部错误,并建议运行 Windows 系统更新准备工具。我已经这样做了,但没有什么不同。

这里有一个报告有人遇到同样的问题但没有回应:

https://social.msdn.microsoft.com/forums/windowsdesktop/en-us/5938da72-16a4-46ef-9151-986b4bd6a60b/need-help-in-installing-dll-into-winsxs

我认为托管 DLL 没有任何问题,因为我可以使用 gacutil 手动将其安装到 GAC 中。

这让我发疯。

4

2 回答 2

0

Okay, so after LOTS of trial and error, I eventually found the problem.

My MSI is actually 4 merge modules - an unmanaged C++ DLL that needs to be installed in WinSxS, the corresponding VS2005 run-times (don't ask) and a managed C++ wrapper that needs to be installed in the GAC.

One of the merge modules (the managed C++ wrapper) had the same name as the main MSI so when the error message was reported, I thought (naively) that this was the errant module. Of course, the error message is a bit indiscriminate - it was actually the unmanaged C++ DLL (with a different name) that was failing.

The cause of the failure was extremely trivial - the public key token referenced in the manifest for the DLL was wrong. I had mistakenly put the public key token of the Strong Name Key used for the Managed C++ DLL in there rather than the public key token of the Code Signing Certificate.

Sad to say it was a Schoolboy error although, I'm hardly a Schoolboy.

What's annoying is that the error is quite clearly something that could be reported in a much more sensible manner by the installer tool.

So, if you read this and it saves you lots of time, I'm glad. Alas for me, I've lost days of my life that I can never get back.

WinSxS, GAC, assemblies, manifests, yada, yada, yada. It all seems way, way too complicated and fragile to me. Someone, somewhere is having a right good laugh.

于 2014-11-04T14:58:29.517 回答
0

我对第三方合并模块一无所知,尤其是您所说的那些。通常,最好重构并创建一个 setup.exe 引导程序/链接器来处理将它们安装为离散的先决条件。这样,当您的 MSI 安装时它们已经存在并且无论如何都没有连接到您的 MSI。

于 2014-11-04T15:19:35.833 回答