Here is the code for the Product.wxs I am using:
<Product Id="*" Name="abc" Language="1033" Version="1.0.0.0" Manufacturer="def" UpgradeCode="2b75c560-783e-4688-9a02-da09bf986597">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Binary Id="myCustomActionsDLL" SourceFile="..SetupConfigurationindebugSetupConfiguration.CA.dll" />
<CustomAction Id="SetProperty" Execute="immediate"
Property="CA_myCustomAction"
Value="InstallDir=[MergeRedirectFolder];SourceDir=[SourceDir]" />
<CustomAction Id="CA_myCustomAction"
BinaryKey="myCustomActionsDLL"
DllEntry="SetABCConfiguration"
Execute="deferred" Impersonate="no"
Return="check" />
<InstallExecuteSequence>
<Custom Action="SetProperty" After="InstallInitialize">Not Installed</Custom>
<Custom Action="CA_myCustomAction" Before="InstallFinalize">Not Installed</Custom>
</InstallExecuteSequence>
<Feature Id="ProductFeature" Title="abc" Level="1">
<ComponentGroupRef Id="ABCGroup" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="def" Name="def">
<Directory Id="dirFC83E07AC2C77525961486C88A01C277" Name="ABC">
<Directory Id="MergeRedirectFolder"/>
</Directory>
</Directory>
</Directory>
</Directory>
</Fragment>
[CustomAction]
public static ActionResult SetABCConfiguration(Session session)
{
string strSourceFolder = session.CustomActionData["SourceDir"]; // returning blank value
string strWebGeniePhyPath = session.CustomActionData["InstallDir"]; // returning correct value
}
I have deliberately left out the code for component ABCGroup
, it just contains a heat harvested directory, which is a long list.
Please help.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…