首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 操作系统 >

Wix运用整理(一)

2014-05-31 
Wix使用整理(一)??? 由于工作需要,学习了一段时间Wix,总算小有起色。鉴于国内Wix 的普及和使用有限,这里将

Wix使用整理(一)

??? 由于工作需要,学习了一段时间Wix,总算小有起色。鉴于国内Wix 的普及和使用有限,这里将个人遇到得问题和解决方案记录下来,以便交流和相互促进。

?? ?

? ?? ???<Condition Level="0"><![CDATA[HASDESKTOP <> "1"]]></Condition>
? ?? ???<ComponentRef Id="DesktopShortcutComponent"/>
??</Feature>
??? 如果HASDESKTOP属性值不为1,那么此Feature的Level将为0,不会被安装。使用此种方式选择安装需注意HASDESKTOP属性的初始化位置,一定要保证在Feature初始化前进行。否则设置无效。
??? 也可以采用另一种方法选择性安装:
??? HASDESKTOP属性修改的地方添加<Publish>。
? ?? ?<Publish Event="AddLocal" Value="ALL">1</Publish>
? ?? ?<Publish Event="Remove" Value="DesktopFt"><![CDATA[HASDESKTOP <> "1"]]></Publish>
??? 这样效果一样,但是不需要HASDESKTOP的值的初始化在Feature之前。
??? 详细参考 http://www.joyofsetup.com/2007/05/30/feature-conditions-and-ui/
(附注:??注意此种方式下内置属性REMOVE的值就不再为空,那么在安装时也不能以REMOVE来判断当前操作)

如果改为小写,那么其他文件(也许是fragment)的代码调用属性无效。
搜索、判断得到的属性一律为全局属性,大写。例如:
<Property Id="VC71PATH">
? ?? ?<RegistrySearch Id="VC71" Type="raw" Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio\7.1" Name="InstallDir"/>
</Property>
上述例子为在注册表中查找VC71的InstallDir的值,如存在将值付给VC71PATH,不存在则VC71PATH为空。

<String Id="LicenseThirdPartText" Overridable="yes">请仔细阅读以下声明</String>
</WixLocalization>
调用方式为:text =”!(loc.LicenseThirdPartText)”

<CustomAction Id="QtExecExample" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="immediate" Return="check"/>
<InstallExecuteSequence>? ?
? ?<Custom Action="QtExecExample" After="TheActionYouWantItAfter"/>
</InstallExecuteSequence>
采用安静模式执行CMD操作,但是不出现CMD命令窗口。注意Value中的命令以及应用程序必须加引号,即使没有空格也要加上。

例2,安静模式下执行其他应用程序操作
<CustomAction Id="QtExecDeferredExampleWithProperty_Cmd" Property="QtExecDeferredExampleWithProperty"
? ?? ?? ?? ???Value=""[#MyExecutable.exe]"" Execute="immediate"/>
<CustomAction Id="QtExecDeferredExampleWithProperty" BinaryKey="WixCA" DllEntry="CAQuietExec"
? ?? ?? ?? ???Execute="deferred" Return="check" Impersonate="no"/>

<InstallExecuteSequence>
? ? <Custom Action="QtExecDeferredExampleWithProperty_Cmd" After="CostFinalize"/>
? ? <Custom Action="QtExecDeferredExampleWithProperty" After="TheActionYouWantItAfter"/>
</InstallExecuteSequence>

2.ShellExecute CustomAction 执行打开文档或URL等操作。典型应用为安装完成后打开帮助文件或则运行安装程序。
例:
<Property Id="WixShellExecTarget" Value="myapplication.exe" />
? ? <CustomAction Id="LaunchApplication"
? ?? ???BinaryKey="WixCA"
? ?? ???DllEntry="WixShellExec"
? ?? ???Impersonate="yes" />
? ? </Product>

?

?

热点排行