如何防止Installshield删除文件?

发布于 2024-09-11 16:46:39 字数 678 浏览 5 评论 0原文

我正在使用Installshield 2008 Primer Edition 开发一个包,项目类型是Installscript MSI 项目。

我面临的问题是在安装过程中,我将一些文件安装到以下位置 C:\Program Files\Company\SystemFiles 从此位置我将文件集复制并添加到 System32文件夹,它包含DLL和OCX文件,已使用Installscript复制到System32文件夹中。

因此,在卸载过程中,已安装的文件将从 System32 中删除,因为需要同一组 DLL 的其他依赖应用程序已停止工作。

我已经使用 Installscript 将文件从 ProgramFiles 复制到 System32 文件夹,而不是使用内置选项,因为我们在升级过程中遇到问题,以避免我使用 Installscript。

即使我尝试了几种解决方法,例如使用安装脚本将文件复制到 System32 后设置文件属性,例如 FILE_ATTR_SYSTEM 设置系统属性,但在卸载过程中文件仍然会被删除。

知道如何将文件属性指定为永久共享;这会有所帮助吗?如果有的话,那么我如何使用 Installscript 来设置它?

I am developing a package using Installshield 2008 Primer Edition and Project type is Installscript MSI project.

The problem I am facing is during installation I am installing some of the files to the following location C:\Program Files\Company\SystemFiles from this location I am copying and adding the set of files into System32 folder, it contains DLLs and OCX files, copying into the System32 folder has been done using Installscript.

Due to this during uninstallation, the installed file is getting removed from System32 due to this other dependent application which requires the same set of DLLs have stopped working.

I have approached Installscript to copy files from ProgramFiles to System32 Folder rather than using built-in options because we have an issue during the upgrade in order to avoid that I am using Installscript.

Even I have tried several workarounds like setting the file attributes after file copies to System32 using Installscript like FILE_ATTR_SYSTEM which sets the system attribute but still files are getting removed during uninstallation.

Any idea how to give file attributes as PERMANENT or SHARED; will this help, and if it will, then how can I set it using Installscript?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

韬韬不绝 2024-09-18 16:46:39

我有2个想法
1)我认为您可以使用共享选项,因为这不会在卸载时删除文件。

2)此外,当我遇到类似的问题时,我所做的是将所有必需的文件放入安装目录本身,以便在卸载时仅删除已安装的文件。(我知道这不是最好的解决方案)

(注意:我大约 6 年前曾从事过安装屏蔽工作,所以只记住某些事情)

I have 2 ideas
1)I think you can use SHARED option as this wont remove the files while uninstallation.

2)Also when i was facing similar issue , what i did was putting all the required files in the installation directory itself so that while uninstalling only the installed files will be removed.(I know this is not a best solution)

(NOTE:I have worked on Install shield some 6 years back and so remember only certain things)

凉月流沐 2024-09-18 16:46:39

您还可以从安装脚本禁用日志记录。这将使安装程序“忘记”它安装了特定的文件组或功能。

您应该确保在复制要永久保留在系统上的文件后再次启用日志记录。

如果您在禁用日志记录后忘记启用日志记录,则卸载过程可能无法正常工作。

语法如下:
禁用(日志记录);

//添加代码以在此处复制永久文件
启用(日志记录);

You can also disable logging from Install Script. This will make the installer "forget" that it installed specific files groups or features.

You should make sure to enable logging once again after you have copied the files that you want to permanently leave on the system.

If you don't remember to enable logging after you have disabled it, your uninstall process may not work correctly.

Syntax is as follows:
Disable(LOGGING);

//Add code to copy your permanent files here
Enable(LOGGING);

妞丶爷亲个 2024-09-18 16:46:39

对于InstallScript项目:
要防止特定组件中的文件在卸载过程中被删除:
1 - 从“组织”文件夹中选择“组件”视图。
2-选择包含您不想在卸载过程中删除的文件的组件。
3-将右窗格中的“卸载”属性更改为“否”值。

对于 MSI 项目:
要防止特定组件中的文件在卸载过程中被删除:
1 - 从“组织”文件夹中选择“组件”视图。
2-选择包含您不想在卸载过程中删除的文件的组件。
3-将右窗格中的“永久”属性更改为值“是”。

For InstallScript projects:
To prevent the files in a particular Component from being removed during uninstall:
1-Select the Components view from within the Organization folder.
2-Select the component that contains the files you do not wish to remove during uninstall.
3-Change the "Uninstall" property in the right pane to a value of "No."

For MSI Projects:
To prevent the files in a particular Component from being removed during uninstall:
1-Select the Components view from within the Organization folder.
2-Select the component that contains the files you do not wish to remove during uninstall.
3-Change the "Permanent" property in the right pane to a value of "Yes".

勿忘初心 2024-09-18 16:46:39

我发现这是一个老问题,但我刚刚遇到这个问题。似乎是一个常见问题。一种好的解决方案是将文件暂存到私有目录(主要是程序文件),然后使用自定义操作进行复制和注册(ocx 等)。 Installshield 会记住它复制的内容,因此往往会删除它们。不要打扰其他任何事情,例如日志记录(我的建议)。设置自定义操作的条件,使其在卸载期间不会运行。
尽管不久前我做了另一个奇怪的实现,只有程序员习惯这样做。将文件打包为资源并创建我自己的代码来提取和部署(Process Explorer 类型的工具所做的事情)。某些用例需要这种实现方式。但这又很复杂,而且显然是重新发明轮子。除非您擅长 C/C++ 和 Windows API,否则这将很困难。我仍然建议您远离这种实现,因为它也被认为是“恶意行为”。然而,到目前为止,我从未收到过来自反恶意软件产品的警告。

I see this is an old question but I just came across this. Seems to be a common problem. One good solution is to stage the files to a private directory mostly program files and then have a custom action do the copy and register (ocx etc). Installshield remembers what it copied so it tends to remove them. Do not disturb anything else like logging (my recommendation). Set conditions on the custom action so that it doesn't run during Uninstall.
Although sometime back I did another weird implementation which only programmers are used to doing.. Packed the files as resources and created my own code to extract and deploy (Something that Process Explorer kind of tool does). There were certain use cases that warranted this kind of implementation. But again this is complicated and obviously reinventing the wheel. Unless you are good with C/C++ and Windows API this would be difficult. I would still suggest you stay away from this kind of implementation because it is also considered a "virulent behavior". Yet, so far I never got warnings from the Anti-malware products.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文