Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Changing ProductCode at runtime


2 replies to this topic

rahmed

rahmed
  • Members
  • 4 posts

Posted 07 November 2005 - 21:15

Hi, I have an Installshield project which can install different flavors of a product based on the entered serial number. I want to give each flavor its own product code. I tried to use the MsiSetProperty() method to do this. The method returns success but the product is installed using the product code specified in "General Information|ProductProperties". Can any one guide me why it is not working. Thanks.
CODE

retCode = MsiSetProperty(ISMSI_HANDLE,"ProductCode",
                        "{979D84E8-BA46-4653-89F2-C2CD73997344}");
if (ERROR_SUCCESS != retCode) then  
 Sprintf(message, "Failed - Error = %d", retCode);
 MessageBox(message, INFORMATION);
else
 Sprintf(message, "Succeeded - Error = %d", retCode);
 MessageBox(message, INFORMATION);
endif;


Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 08 November 2005 - 11:46

No offence, but this sounds like a very dodgy approach. The product code is a very integral part of an MSI setup. I am not sure you can change the product code on the fly after the setup has launched. You may be able to change the product code by applying a different transform file to the same base MSI. It would probably be best to run this logic in a custom setup.exe that would then call the MSI with the appropriate MST file to install the correct flavor of the product.
Regards
-Stein Åsmul

rahmed

rahmed
  • Members
  • 4 posts

Posted 09 November 2005 - 20:46

OK, I'll go with the transform approach then. However I tried it and it does not seem to work correctly. If I install the product using a transform that changes the product code and then retry with a new transform that also changes the product code, it works correctly. But if I install the product without a transform and then install the product using a transform that changes the product code, in that case it brings up the maintenance dialog. Can some one tell me why is this happening. I checked MSDN pages and according to it, this should work just like the first scenario. I am using Installshield 10.5 generated InstallScript MSI project.

Thanks.