编辑其他文件后无法在 MSI 中找到文件

File can't be found in MSI after editing a different file

我正在用 c# 编写一个实用程序来编辑我的 MSI 中的一个文件(CAB 是嵌入式的)。我的方法是打开数据库,执行我的视图,将流保存到 cab 文件,解压缩文件,编辑我想要的文件,保存,重新打包,然后将流保存回数据库。

未安装的文件是序列 17,所以我假设前 16 个工作正常。无论如何我都没有改变它,我收到了标准 "The file ... cannot be installed because the file cannot be found in cabinet file cab1.cab"

原来的 MSI 是用 WiX 创建的。 这是失败的日志的一部分:

MSI (s) (88:54) [08:51:02:963]: File: C:\ProductDir\File1.exe;  To be installed;    Won't patch;    No existing file
MSI (s) (88:54) [08:51:02:963]: Source for file 'File1' is compressed
InstallFiles: File: File1.exe,  Directory: C:\ProductDir\,  Size: 38538352
MSI (s) (88:54) [08:51:03:205]: Executing op: FileCopy(SourceName=d-c9wzx6.dll|FailingFile.dll,SourceCabKey=FailingFile,DestName=FailingFile.dll,Attributes=512,FileSize=1286768,PerTick=65536,,VerifyMedia=1,,,,,CheckCRC=0,Version=2.6.0.4,Language=1033,InstallMode=58982400,,,,,,,)
MSI (s) (88:54) [08:51:03:205]: File: C:\ProductDir\FailingFile.dll;    To be installed;    Won't patch;    No existing file
MSI (s) (88:54) [08:51:03:205]: Source for file 'FailingFile' is compressed
InstallFiles: File: FailingFile.dll,  Directory: C:\ProductDir\,  Size: 1286768
MSI (s) (88:54) [08:51:03:206]: Note: 1: 1334 2: FailingFile 3: cab1.cab 
Error 1334. The file 'FailingFile' cannot be installed because the file cannot be found in cabinet file 'cab1.cab'. This could indicate a network error, an error reading from the CD-ROM, or a problem with this package.
MSI (s) (88:54) [08:51:04:317]: Product: MyProduct V2.2.0 -- Error 1334. The file 'FailingFile' cannot be installed because the file cannot be found in cabinet file 'cab1.cab'. This could indicate a network error, an error reading from the CD-ROM, or a problem with this package.

安装程序日志告诉您什么?您是否更新了 File table 中的 FileSize 列?编辑 MSI 后,您是否 运行 MSI 验证。

我的直觉是你创建了一个格式错误的 MSI,但我需要更多信息来更具体地说明如何修复它。