首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Wix bootstarpper 属性传递给 CustomeAction 值为什么一直为空?

Wix bootstarpper 属性传递给 CustomeAction 值为什么一直为空?

提问于 2019-05-28 10:53:50
回答 0关注 0查看 267

希望把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"];

回答

和开发者交流更多问题细节吧,去 写回答
相关文章

相似问题

相关问答用户
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档