在编辑不同的文件后,在MSI中无法找到文件

本文关键字:文件 MSI 编辑 | 更新日期: 2023-09-27 18:10:40

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

未安装的文件是序列17,所以我假设前16个工作正常。无论如何,我没有改变它,我收到标准的"文件……无法安装,因为在机柜文件"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.

在编辑不同的文件后,在MSI中无法找到文件

安装日志告诉你什么?您是否更新了"文件"表中的"文件大小"列?编辑MSI后是否运行了MSI验证。

我的直觉是你已经创建了一个畸形的MSI,但我需要更多的信息来更具体地解决它。