![](/img/trans.png)
[英]How passing installationpath as parameter to a MSI file made with WIX
[英]How to passing checkbox values to MSI file WIX
我已經創建了安裝文件的 WPF 並有一個復選框讓用戶決定顯示“桌面快捷方式”。 但我在將其發送到 MSI 文件時遇到了問題。
這是創建桌面快捷方式。 但我想在這里添加一個條件。 如果 WPF 復選框被選中“我想將它添加到桌面”,如果沒有任何反應。
<Component Id="DesktopShortcutComponent" Guid="*">
<RegistryValue Id="RegShortcutDesktop" Root="HKCU" Key="SOFTWARE\MyProject\1.0\settings" Name="DesktopSC" Value="1" Type="integer" KeyPath="yes" />
<Shortcut Id="desktopSc" Target="[MYINSTALLFOLDER]\MyApplication.exe" Directory="DesktopFolder" Name="MyApplication" Icon="MyProductIcon" IconIndex="0" WorkingDirectory="MYINSTALLFOLDER" Advertise="no" />
<RemoveFolder Id="RemoveShortcutFolder" On="uninstall" />
</Component>
如何將自定義創建的 wpf 之間的值傳遞到 msi 文件?
我必須使用“引導程序的字符串值”嗎?
BootstrapperApplication.Engine.Plan["checkBoxValues"]
您可以像這樣設置字符串或數字變量
BootstrapperApplication.Engine.StringVariables["InstallDir"] = "somePath";
BootstrapperApplication.Engine.StringVariables["Cbx"] = "True";
BootstrapperApplication.Engine.NumericVariables["Variable"] = 1;
在 Bundle.wxs
<Variable Name="InstallDir"
bal:Overridable="yes" />
<Variable Name="Cbx"
bal:Overridable="yes"/>
<MsiPackage SourceFile="$(var.Some.Setup.TargetDir)Some.Setup.msi"
Id="InstallationPackageId"
Visible="no">
<MsiProperty Name="INSTALLFOLDER" Value="[InstallDir]" />
<MsiProperty Name="CBX" Value="[Cbx]" />
</MsiPackage>
產品.wxs
<Property Id="CBX" Value="False" Secure="yes" />
<Component Id="Shortcut"
Directory="INSTALLFOLDER"
Guid="68D52920-E643-42F9-B1C6-8D9D1D8C8B2E">
<RegistryValue Id="RegShortcutDesktop"
Root="HKCU"
Key="SOFTWARE\MyProject\1.0\settings"
Name="DesktopSC"
Value="1"
Type="integer"
KeyPath="yes" />
<Shortcut Id="desktopSc"
Target="[INSTALLFOLDER]\Podit.exe"
Directory="INSTALLFOLDER"
Name="Podit"
Icon="icon.ico"
IconIndex="0"
WorkingDirectory="INSTALLFOLDER"
Advertise="no" />
<Condition><![CDATA[CBX = "True"]]></Condition>
</Component>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.