Installshield:卸载后如何保留文件
我正在使用 installshield 11 创建基本 MSI 项目。我的要求是,当我卸载项目时,我想保留某些文件。(我不希望在卸载时删除这些某些文件)。此外,这些文件不是组件的一部分,而是在安装过程中通过使用特定位置的 copyfile(脚本)命令创建(复制)它们的。
-开发者
I am using installshield 11 to create Basic MSI Project. My requirment is, when i unstall the project, i want to preserve certain files.( I don't want these Certain files to be removed when unstallation takes place ). Morover, these files are not a part of the component, but they are created(copied) during installation process by using copyfile (script) command from specific location.
-Dev
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
使用禁用(日志记录)...启用(日志记录)。在这些方法之间使用 CopyFile() 将阻止卸载删除文件
Use Disable(LOGGING)....Enable(LOGGING). Using CopyFile() in-between these methods will prevent uninstall removing the files
Windows 安装程序仅删除它安装的文件和文件夹。这是文件表和文件夹表中数据库中存在的每个文件。它不会删除文件表中没有条目的任何文件,类似于文件夹。
另外,如果文件夹不为空,则在卸载过程中该文件夹不会被删除。
如果您使用 Copyfile 脚本安装某些文件(可能使用任何自定义操作),那么这些文件在卸载过程中不会被删除。
Windows installer removes only those files and folders which it installs. That is each file present in it's database in File table and Folder table. It do not remove any file which does not have entry in File table, similar for folder.
Also, If folder is not empty then that folder does not get deleted during uninstall.
If your installing some files using Copyfile script ( may be using any custom action) then those files will not be removed during uninstall.
感谢 Balachandra 的回复,但我有以下观察可能会有所帮助。
我想要保留的文件是由 CopyFile 创建的,并且我在 copyfile 命令中提到的目标目录不存在。因此 CopyFile 创建文件夹并将文件复制到该文件夹。因此,显然我们不会在 installsheild 的目录表中包含此文件夹条目
,但这种方法没有帮助,卸载会从此文件夹中删除所有复制的文件。
-开发者
Thanks Balachandra for your response, But i have below observation which might help.
Files which i want to preserve is created by CopyFile, and target dir which i mention in the copyfile command does not exist. So CopyFile creates the folder and copy the file to that folder. So obviosly we will not have this folder entry in the dir table of installsheild
But this approach does not help, uninstallation is removing all copied files from this folder.
-Dev
谢谢,Alerter,我已经和这个问题斗争了两天了。
我们安装一个示例配置文件并创建它的副本(在第一次安装时)。如果客户更改了配置文件,我们需要保留它,但该文件总是在卸载时被删除。禁用 CopyFile 命令周围的 LOGGING 正是这种情况的解决方案。
开发人员,我知道这是一篇旧帖子,但您应该接受它作为正确的答案。
希望这句话能帮助其他人通过搜索引擎更轻松地找到此解决方案:使用 CopyFile 创建的 Installshield 文件在卸载过程中始终会被删除
Thanks, Alerter, I've been fighting this one for 2 days.
We install an example configuration file and create a copy of it (on first installation). We needed to preserve the configuration file if the customer changed it, but the file was always getting deleted on uninstall. Disabling the LOGGING around the CopyFile command was exactly the solution for this situation.
Dev, I know this is an old post, but you should accept this as the correct answer.
Hopefully this phrase will help others find this solution easier through the search engines: Installshield file created with CopyFile is always deleted during uninstall