Q:

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.
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.

A:

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.

