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

Need urgent help on Dynamic INSTALL DIR


4 replies to this topic

Jayag

Jayag
  • Members
  • 7 posts

Posted 24 March 2006 - 01:06

Hi,

I want to dynamically change the [INSTALLDIR] property. We have 2 different type of products, "ProductType1" and "ProductType2". 95% of the components are same for both the product types. Only 5% of the components differ based on the product type.

I created 2 features for each product type. I then associated the common components to both the features and then the differing components seperately to their corresponding product type features. Now the problem is, I need to have the install directory based on the feature selected at run time.
ie

for ProductType1 the install directory should be
"[ProgramFilesFolder]\CompanyName\ProductType1" &
for ProductType2 the install directory should be
"[ProgramFilesFolder]\CompanyName\ProductType2"

I want to acheive it by not having to duplicating the 95% common components. Also i need to write the Final Install Directory into the registry too..

Any help would be greatly appritiated.

thanks & regards,
Jayashree



antyagi

antyagi
  • Full Members
  • 121 posts

Posted 24 March 2006 - 06:04

Have you tried MsiSetTargetPath function?
  ankur tyagi

MrSmersh

MrSmersh
  • Full Members
  • 48 posts

Posted 24 March 2006 - 11:08

You will need somenthing on the lines of:


// Determine the installed state of FeatureProduct1.
nResult = FeatureIsItemSelected (MEDIA, "eatureProduct1");

szCommonPathPart=PROGRAMFILES^"CompanyName";

if nResult = 1
then
FeatureSetTargetMEDIA, "<INSTALLDIR>",
szCommonPathPart^"ProductType1");
else
FeatureSetTargetMEDIA, "<INSTALLDIR>",
szCommonPathPart^"ProductType2");



Jayag

Jayag
  • Members
  • 7 posts

Posted 26 March 2006 - 17:11

Hi all,

Thanks for the immediate response. But FeatureIsItemSelected method is NOT working for me. Even though i select a particular feature from the AskOptions dialog, it always returns an error -105 (which is Specified feature cannot be found in the media). . The below code snippet is how i tried to use the FeatureIsItemSelected method. can you please tell me what mistake i am doing.


nResult = SdAskOptions ("Product Selection", "Select the product to install.",
"", "", "DefaultFeature",
EXCLUSIVE);

if (nResult = BACK) goto Dlg_SdCustomerInformation;

szInstallDirPath = "";
szInstallDirPath = INSTALLDIR;

nRes = FeatureIsItemSelected(MEDIA, "Prod1");

if nRes = 1 then
szInstallDirPath = szInstallDirPath^"Prod1";
else
szInstallDirPath = szInstallDirPath^"Prod2";
endif;

FeatureSetTarget(MEDIA, "<INSTALLDIR>", szInstallDirPath);

I also tried to use "FeatureGetData", but it also returns false everytime.

thanks & regards,
Jayag

Edited by Jayag, 27 March 2006 - 00:59.


Jayag

Jayag
  • Members
  • 7 posts

Posted 27 March 2006 - 01:20

Hi All,

I found the problem with my code. Actually i had the Prod1 under DefayltFeature. So i had to use

nRes = FeatureIsItemSelected(MEDIA, "DefaultFeature\\Prod1");

instead of

nRes = FeatureIsItemSelected(MEDIA, "Prod1");

thanks & regards,
Jayashree