cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
feiyanghu123
Level 2

FeatureAddCost return -1

HI,
I use this method and feature's size still zero (actually, no files included in it, but I need non zero cost):
function OnBegin()
STRING szRunKey,szProductName,szRunValue,szTemp,szCmd;
NUMBER nvServiceState,nType,nSize,nCostHigh,nCostLow;

begin
// TO DO: you may change default non-UI setting, for example
//
nType=CalculateAndAddFileCost( 0, 250 * 1024 * 1024, TEMPPATH, 0, nCostHigh, nCostLow );
nType=FeatureAddCost( MEDIA, "DefaultFeature", TEMPPATH, nCostHigh, nCostLow );

// You may also perform your custom initialization steps, check requirements, etc.
end;
Labels (1)
0 Kudos
(2) Replies
sibot13
Level 3

I am getting this same problem. Below is the code I used in the OnBegin event.

Am I missing something with the FeatureAddCost function. I've followed what little examples I can find. Sending the install dir before the user actually has a chance to select the install directory seems odd to me

if(0 == GetAndAddFileCost ( SRCDIR^"Exchange Protection Manager.msi", INSTALLDIR, 0, nvCostHigh, nvCostLow )) then
FeatureAddCost ( MEDIA, "EPM_Client", INSTALLDIR, nvCostHigh, nvCostLow );
endif;
0 Kudos
Thomas_Hübner
Level 3

I still have the same problem with InstallShield 2012 Spring.

I want to add some additional size to a feature, because this feature created a volume of a database (in our case the MaxDB from SAP). I tried to add 512 MB with this code in OnBegin():


CalculateAndAddFileCost(0, 512 * 1024 * 1024, INSTALLDIR, 0, nCostHigh, nCostLow);
nResult = FeatureAddCost(MEDIA, "Server\\Core\\MaxDB", INSTALLDIR, nCostHigh, nCostLow );
if (nResult < ISERR_SUCCESS) then
SprintfBox(SEVERE, "", "Error: %d", nResult);
endif;


But I always get a -1 form FeatureAddCost.

Is there a soltion for it or did I something wrong? Unfortunately there are not much examples.

Thanks in advanced,
Thomas
0 Kudos