希望把Bootstarpper自定义变量,传递给MSI中 的Customer Action,但是Customer取得的属性DataPatProperty
一直为空 ,希望的内容为D:\MSI\MyData.dat。不知道哪里搞错了, 使用的Wix版本为 3.11。
定义Wix Burn 文件,如下:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Bundle Name="Bootstrapper" Version="1.0.0.0"
Manufacturer="abc" UpgradeCode="628f2439-ad22-49c7-99df-f1fa3974c4be">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<Variable Name="DataPath" Type="string" Value="D:\MSI\MyData.dat"/>
<Chain>
<MsiPackage SourceFile="D:\Abc.msi"
Compressed="no"
ForcePerMachine="no"
Permanent="no"
Vital="yes" >
<MsiProperty Name="DataPatProperty" Value="[DataPath]"/>
</MsiPackage>
</Chain>
</Bundle>
</Wix>
MSI 文件主要内容:
<Product Id="*" Name="UserProjectMsi" Language="1033" Version="1.0.0.0" Manufacturer="delta" UpgradeCode="f1bb7fe9-2372-4f5e-b21e-6dc952d4afff">
<Package InstallerVersion="405" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="UserProjectMsi" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
<!--自定义CustomeAction -->
<Binary Id="myCA" SourceFile="$(var.CustomAction.TargetDir)CustomAction.CA.dll" />
<!-- 将用戶工程添加到项目中 -->
<CustomAction Id="AddUserProject" BinaryKey="myCA" DllEntry="AddUserProject" Execute="immediate" Return="ignore"/>
<!--执行序列-->
<InstallExecuteSequence>
<Custom Action="AddUserProject" After="InstallFinalize" Overridable="yes">NOT Installed</Custom>
</InstallExecuteSequence>
...
</Product>
CustomeAction主要内容:
[CustomAction]
public static ActionResult AddUserProject(Session session)
{
// TODO 这里dataPath值为空,希望得到的值为 “D:\MSI\MyData.dat”
string dataPath = session["PropertyDataPath"];
相似问题