我一直在努力处理这个Wix安装程序的东西。我需要做的是将执行安装的人选择的JRE路径存储在一个属性中(我认为我需要这样做)。拥有该属性后,我打算在安装结束时以某种方式使用它,以将该值写入文件中。
问题在于我似乎无法在属性中存储DirectoryCombo / DirectoryList / PathEdit的值...
我的代码是这样的:
<!-- I use this to initialize the JREPATH to the most likely path..This works as expected -->
<CustomAction Id='INIT_JREPATH' Property='JREPATH' Value='[ProgramFilesFolder]\Java' Execute='firstSequence' />
<!-- When this button is clicked, a new dialog is opened, where the UI elements have the path initialized above..This works as expected.. -->
<Control Id='BrowseButton' Type='PushButton' X='276' Y='126' Width='90' Height='18' Text='{\VSI_MS_Sans_Serif13.0_0_0}B&rowse...' TabSkip='no'>
<Publish Property='SelectJreFolderDialog_Property' Value='JREPATH'><![CDATA[1]]></Publish>
<Publish Event='SpawnDialog' Value='SelectJreFolderDialog'><![CDATA[1]]></Publish>
</Control>
<!-- This is where I got stuck -->
<Dialog Id='SelectJreFolderDialog' X='50' Y='50' Width='313' Height='223' Title='Browse for JRE Installation Folder' NoMinimize='yes'>
<Control Id='OKButton' Type='PushButton' X='168' Y='198' Width='66' Height='18' Text='{\VSI_MS_Sans_Serif13.0_0_0}OK' TabSkip='no' Default='yes'>
**<!-- The code from below are various attempts that I tried to set the property at button click**
<Publish Property='SelectJreFolder_Property' Value='C:\Program Files (x86)\Java\jre1.8.0_181'><![CDATA[1]]></Publish>
<Publish Event='SetProperty' Value='[SelectJreFolderDialog_Property]'><![CDATA[1]]></Publish>
<!-- <Publish Event='SetTargetPath' Value='[SelectJreFolderDialog_Property]'><![CDATA[1]]></Publish> -->
<Publish Event='EndDialog' Value='Return'><![CDATA[1]]></Publish>
</Control>
<Control Id='CancelButton' Type='PushButton' X='240' Y='198' Width='66' Height='18' Text='{\VSI_MS_Sans_Serif13.0_0_0}Cancel' TabSkip='no' Cancel='yes'>
<Publish Event='Reset' Value='{}'><![CDATA[1]]></Publish>
<Publish Event='EndDialog' Value='Return'><![CDATA[1]]></Publish>
</Control>
<Control Id='BrowseText' Type='Text' X='6' Y='9' Width='60' Height='12' Text='{\VSI_MS_Sans_Serif13.0_0_0}&Browse:' TabSkip='no' />
<Control Id='FolderCombo' Type='DirectoryCombo' X='66' Y='6' Width='198' Height='120' Property='SelectJreFolderDialog_Property' Text='{\VSI_MS_Sans_Serif13.0_0_0}MsiDirectoryCombo' TabSkip='no' Indirect='yes' Removable='yes' Fixed='yes' Remote='yes' RAMDisk='yes' Floppy='yes'>
<Publish Property='SelectJreFolder_Property' Value= '[SelectJreFolderDialog_Property]' ><![CDATA[1]]></Publish>
</Control>
<!-- I have other elements here, a DirectoryList and a PathEdit, basically different approaches to selec the needed path..I did not add them because I don't think that they are relevant -->
</Dialog>
问题是..这不起作用...当我尝试设置该值时,在下一个对话框中实际发生的是我得到的值是“ JREPATH”,而不是安装人员选择的内容。 .ex代替C:\ blsa bla \ java
我该如何解决?有什么建议吗?...最好的方法是在按OK时存储DirectoryCombo中的值...不确定这样做是否可行。
非常感谢!
答案 0 :(得分:0)
<Publish Property='SelectJreFolderDialog_Property' Value='JREPATH'><![CDATA[1]]></Publish>
您需要将Value设置为[JREPATH],如下所示:
<Publish Property='SelectJreFolderDialog_Property' Value='[JREPATH]'><![CDATA[1]]></Publish>
答案 1 :(得分:0)
该问题通过删除以下行得以解决:
<Publish Property='SelectJreFolder_Property' Value= '[SelectJreFolderDialog_Property]' ><![CDATA[1]]></Publish>