Showing results for 
Search instead for 
Did you mean: 

FeatureGetCostEx fails to return value for MEDIA

I have an InstallScript only setup in which I am using FeatureGetCostEx.

Below is my code that I am using.

lAllFeatures = CreateNewList(STRINGLIST);
nRetVal = FeatureListItems(MEDIA, TOPOFEATURE, lAllFeatures);
nRetVal = ListGetFirstString(lAllFeatures, sFeature);
sMedia = MEDIA; //verifying that I have MEDIA set correctly
while (nRetVal != END_OF_LIST)
nCostHigh = 0;
nCostLow = 0;
if (FeatureIsItemSelected(MEDIA, sFeature)) then
nRetVal = FeatureGetCostEx(MEDIA, sFeature, pTargetDir, nCostHigh, nCostLow);
CalculateAndAddFileCost(nCostHigh, nCostLow, pTargetDir, 0, nSelectedCostHigh, nSelectedCostLow);
nRetVal = ListGetNextString(lAllFeatures, sFeature);

Note that the while loop I added after my attempt to get the cost of all features in MEDIA failed.

The problem is that FeatureGetCostEx is returning zero bytes for all the selected features in MEDIA.

In this same function I also have a runtime MediaSource called FOOMEDIA. I specify szFeature = "". The target is the same as in the previous code example. This returns a valid size in nCostLow, just as I would expect.

I have verified that I am getting a valid feature. I have also verified that each selected feature has a component and files. I have attached a report from the Cab File Viewer utility.

Any ideas why I am not seeing values for this? Thanks.
Labels (1)
0 Kudos
2 Replies

Install shiled 12 problem,,

Dear Friends

I need some urgent help from you guys...

advance thanks to u..

I am new to problem is i created new installer with my install shiled 12..

after i added all my dlls and all...and i did "batch build" to create new installer file..everything going good..but new installer is coming with "Programfiles folder".in that programfiles folder have all dlls which i include in code,,,now i copied my generated installer file and try to install,,its saying some dll is missing,,

but i copied whole new release folder and try to install,,its installing,,becoz in that folder all dlls is there in program folder,,,now my questions is why new program file is creating with all dlls...i want to use one .msi file to test other system,,its not good to give whole folder to client....pls give me idea why its creating new program files folder will all dlls

thanks in advance

0 Kudos

SOLUTION - Make sure that targetdir is the same as component

The problem comes from my misunderstanding of how this function works. The targetdir argument must be the same value as the component target otherwise since the target of the component is different, then there is no cost to the specified targetdir.

The solution I came up with is to modify TARGETDIR temporarily. I first backup TARGETDIR and then set TARGETDIR to my target I want to test. After I call FeatureGetCostEx then I reset TARGETDIR to the original value. I chose this method because there are a couple of other tests I want to do before changing TARGETDIR.
0 Kudos