Automatically create new entry in “Programs and Features” for each new version

妖精的绣舞 提交于 2021-01-25 07:32:14

问题


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.

I assume I can do that by changing GUID.

  • Is this the correct way of doing it?
  • And can I somehow automate the process and depend GUID generation on app version automatically?

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.


回答1:


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.

By default, the AppId equals to AppName.

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")}

For the above to work, the AppId must be below the AppName and AppVersion.



来源:https://stackoverflow.com/questions/34492049/automatically-create-new-entry-in-programs-and-features-for-each-new-version

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!