编辑其他文件

时间:2015-09-01 16:19:28

标签: c# windows-installer

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

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

1 个答案:

答案 0 :(得分:1)

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

我的直觉是你创建了一个格式错误的MSI,但我需要更多信息来更具体地解决它。