在“程序和功能"中自动创建新条目.对于每个新版本 [英] Automatically create new entry in "Programs and Features" for each new version
问题描述
如果仍然存在旧版本的应用程序,我想在程序和功能"屏幕中保留一个旧条目,并且仅当安装了相同版本时才覆盖该条目(在这种情况下,请卸载旧实例).如果版本不同,这应该允许我们保留应用程序的多个版本.
I want to keep an old entry in "Program and Features" screen, if an old version of application is yet present, and only override the entry if the same version was installed (and uninstall the old instance in that case). This should allow us to keep several versions of our application if the versions are different.
我认为我可以通过更改GUID来做到这一点.
I assume I can do that by changing GUID.
- 这是正确的做法吗?
- 我可以以某种方式自动执行该过程,并自动将GUID生成依赖于应用程序版本吗?
我们使用构建脚本来自动化Inno Setup运行,并且通常不会在发布新版本之前对其进行编辑,而该新版本的构建脚本用于管理新版本.
We use build script to automate Inno Setup run, and it isn't usually edited before the new version is released, the build script used to manage new versions.
推荐答案
To keep different versions of the same application in "Programs and Features", you need to assign a different value to AppId
directive for each version.
默认情况下,AppId
等于 AppName
.
By default, the AppId
equals to AppName
.
如果要使每个版本的值唯一,请包含 AppVersion
的值.您可以为此使用预处理器功能SetupSetting
:
If you want to make the value unique for each version, include AppVersion
to the value. You can use a preprocessor function SetupSetting
for that:
[Setup]
AppName=My Program
AppVersion=1.5
AppId={#SetupSetting("AppName")}_{#SetupSetting("AppVersion")}
要使上面的内容正常工作,AppId
必须在 和AppVersion
之下.
For the above to work, the AppId
must be below the AppName
and AppVersion
.
这篇关于在“程序和功能"中自动创建新条目.对于每个新版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!