问题
I have Basic MSI project (I use InstallShield 2013 Professional). Suppose it has ProductName DefaultProductName.
I can build it and get setup.exe. It will appear in a list of Installed Programs in Control Panel with DefaultProductName name if I install it.
Now, suppose that I want to change my ProductName from DefaultProductName to NewProductName during install, in runtime (to be more clear: I'm talking not about Upgrades, but about situation when I'm installing my product on "clean" box).
For this purpose I created New Custom Action->New Set Property and set ProductName Property to a new value NewProductName. It works (for example, I can see that new ProductName value appears in titles of installation dialogs, and my product appeared in Control Panel with name NewProductName ).
But when I'm trying to uninstall my product and moving through uninstallation dialogs, I see (in titles of dialogs) that ProductName has its default value DefaultProductName, not the value NewProductName that I set in custom action during install. Does it mean that changes in Property value that I can apply during install will not be available during Uninstall. Why?
回答1:
Because all you altered was the in-memory ProductName of the install, not any actual name in a file anywhere.
If you know before the actual install you could create a transform, a .mst file, and then start the MSI file with a command line that specifies TRANSFORMS=. You'd need an executable to do that first then launch your MSI.
回答2:
The Windows Installer SDK in it's cryptic way implies that this is not possible. In my experience it is not possible. ProductName is a private property and immutable once the installation starts. Editing the MSI or creating and applying a transform is the only way.
来源:https://stackoverflow.com/questions/21759170/can-i-update-productname-property-in-runtime-during-install