安装程序 – WiX:将安装路径传递到托管自定义操作
发布时间:2020-12-14 01:46:23 所属栏目:Windows 来源:网络整理
导读:新的一天,新的问题;-)仍然需要与自定义的行动斗争.我已经管理它来调用自定义操作并将一些测试数据传递给它.现在我想用我需要的真实数据替换testdata.这里的问题开始:我想调用一个批处理文件,它被安装在我的安装的子目录中.因此,我需要将安装路径传递给自定
新的一天,新的问题;-)仍然需要与自定义的行动斗争.我已经管理它来调用自定义操作并将一些测试数据传递给它.现在我想用我需要的真实数据替换testdata.这里的问题开始:我想调用一个批处理文件,它被安装在我的安装的子目录中.因此,我需要将安装路径传递给自定义操作. Afaik这可以使用customactiondata机制来完成.但这不行.当我记录安装时,我可以看到,在定制操作INSTALLLOCATION之外指向正确的路径,但是一旦我查看customaction,customactiondata属性是空的…
任何人都可以看看我的代码,并给我一个提示我做错了什么?感谢你的好意! 调用自定义操作的合并模块: <Module Id="DflHelpInstaller" Language="1033" Version="1.0.0.0"> <Package Id="f952de58-1dc6-46b3-872a-7a49e2d9ea0a" Manufacturer="DflHelpInstaller" InstallerVersion="200" /> <Binary Id='RegisterDflHelpDll' SourceFile="$(var.REGISTERHELP.TargetDir)RegisterDflHelp.CA.dll" /> <CustomAction Id='RegisterDflHelp' BinaryKey='RegisterDflHelpDll' DllEntry='RegisterDflHelp' Execute='deferred' /> <CustomAction Id="RegisterDflHelp.SetProperty" Return="check" Property="RegisterDflHelp" Value='[INSTALLLOCATION]' Execute='immediate' /> <InstallExecuteSequence> <Custom Action='RegisterDflHelp.SetProperty' After='CostFinalize' /> <Custom Action='RegisterDflHelp' After='InstallFiles' /> </InstallExecuteSequence> <Directory Id="TARGETDIR" Name="SourceDir"> </Directory> <ComponentGroupRef Id="HelpGroup"/> </Module> </Wix> 使用MergeModule的安装程序的大纲: …. <Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="ProgramFilesFolder" SourceName="PFFiles"> <Directory Id="Company" Name='$(var.COMPANY)'> <Directory Id="INSTALLLOCATION" SourceName='$var.v[SDK_VERSION]'> <Component Id="MyBanner" Guid="C8C28B92-9326-4991-BFB1-BBDFDF3653AB"> <File Id ="Banner.bmp" Source="Banner.bmp" KeyPath="yes" DiskId="1"/> </Component> <Merge Id ="DflHelpInstaller" SourceFile="DflHelpInstaller.msm" Language="1033" DiskId="1" /> </Directory> </Directory> …. <Feature Id="Complete" Title="Setup" Description="Installs the SDK on your local machine." Display="expand" Level="1" ConfigurableDirectory="INSTALLLOCATION"> <ComponentRef Id="Banner" /> <ComponentRef Id ="UNINSTALLER"/> <ComponentGroupRef Id="ReferenceGroup"/> <MergeRef Id="DflHelpInstaller"/> </Feature> CustomAction: public class CustomActions { [CustomAction] public static ActionResult RegisterDflHelp(Session session) { session.Log("Begin CustomAction1"); session.Log("Before Access to customactiondata"); //should contain the installation path - unfortunatelly it is empty! why? string cad = session["CustomActionData"]; Debugger.Break(); RegisterHelp(cad); session.Log("End of custom action.."); return ActionResult.Success; }
如果你描述你的数据…
<CustomAction Id="MyCustomActionData" Return="check" Property="MyCustomAction" Value='PROPERTY0=[PROPERTY0];PROPERTY1=[PROPERTY1];PROPERTY2=[PROPERTY2]' Execute='immediate' /> 您可以访问以下数据: string property0 = session.CustomActionData["Property0"]; string property1 = session.CustomActionData["Property1"]; string property2 = session.CustomActionData["Property2"]; 在上一个例子中,您将使用: <CustomAction Id="RegisterDflHelp.SetProperty" Return="check" Property="RegisterDflHelp" Value='INSTALLLOCATION=[INSTALLLOCATION]' Execute='immediate' /> 然后 string cad = session.CustomActionData["INSTALLLOCATION"]; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- .NET 4.5中的microsoft.identityModel和system.identityMod
- windows-server-2003 – 是否有理由在Windows Server上升级
- windows-phone-7 – 为什么我从LongListSelector下载时收到
- windows – 在perl中的fork实现
- wix – 安装更改不要求UAC权限
- Windows Azure – 内部IP地址有什么用?
- windows下升级PHP到5.3.3的过程及注意事项
- 如何在Windows上为IOS构建NativeScript项目?
- Windows – XP,Vista,Win7之间的IE8行为差异?
- wpf – Listview XAML中的替代背景颜色
推荐文章
站长推荐
- 在Windows上编译C#.net 3.5控制台应用程序有什么
- windows-server-2008 – 为什么选择MPIO而不是80
- 使用包含空格的参数调用Qprocess – Windows
- windows-phone-8 – 是否有能力上传BackgroundTr
- windows-server-2008 – 具有3台服务器的高可用性
- 窗口 – 如何知道窗口是否具有焦点? (Win32 API
- 在Windows上的80端口上运行node.js webbapp
- windows-phone-7 – 如何在Windows Phone 7的文本
- 如何在Windows上安装和使用cli53工具?
- win7旗舰版系统 64位安装vs2015的条件
热点阅读