iifuzz
Posts: 8
Joined: Thu Jun 29, 2023 3:47 pm

Autogenerate Product Code in UI

I know it is possible to auto generate a product code via command line, however, it does not seem I can get this to work using a pre-build or post-build event unless I restart my advanced installer after every build.

I want to generate a setup that does not pop up with the "this version of product is already installed".
Since I am not necessarily changing versions of my product, I tend to forget pressing the Generate product code button.

Ideally, I would just generate a unique product code on every build.
iifuzz
Posts: 8
Joined: Thu Jun 29, 2023 3:47 pm

Re: Autogenerate Product Code in UI

Any solution for this would be greatly appreciated as it is my last hesitancy before purchasing the software.
Thanks
Liviu
Posts: 1048
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: Autogenerate Product Code in UI

Hello,

Sorry for the delayed reply on this.

Windows Installer can upgrade the original package only if the modified one has a higher version and a different Product Code. If you don't want to create a new version of the package, you need to uninstall the original MSI before installing the modified one.

If you follow your approach and change the ProductCode, you will have multiple versions of the same product installed on your machine. When the first three fields of the old and upgraded version are identical, then the upgrade installation will either fail with "Another version of this product is already installed" message or will be installed side by side with the old version (when using different Product Codes).

If you do not want multiple installations of the same application and want to keep the same ProductVersion, you can use the "Uninstall a package with the same version (if found)" option from the Builds page and keep the same ProductCode. However, this option works only for EXE packages. If a package with the same product code and version as the current package is already installed, enabling this option will uninstall it.

You can also continue to use your current implementation with the Build Events. The new ProductCode will be reflected in the MSI if you changed it with a pre-build event. The expected behaviour is that it will not be updated in the UI when you have the project open and have modified it using the command line.

However, the ProductCode is actually updated at build time and this is reflected in the built MSI, but not in the UI.
productcode build event.png
productcode build event.png (154.31 KiB) Viewed 6564 times

Let us know if you have any questions.

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
iifuzz
Posts: 8
Joined: Thu Jun 29, 2023 3:47 pm

Re: Autogenerate Product Code in UI

Thanks, that was very helpful
Liviu
Posts: 1048
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: Autogenerate Product Code in UI

You're always welcome!

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”