[英]Disable Wix Custom action on /quiet /silent
在WIX自定義操作中,有沒有一種方法可以檢測是否通過/ silent或/ quiet命令行開關調用了MSI? 基本上,我想要的是不執行自定義操作(因為它顯示了表單),或者如果通過了這些命令行開關,但是我無法找到它,則以不同的方式處理它。
有沒有辦法檢測到它?
您可以檢查屬性UILevel並根據您的條件執行CA。
我終於弄明白了。 Wix基本上總是將UILevel屬性設置為2.0。 它具有自己的稱為WixBundleUILevel的屬性。 現在重要的是,在Wix 3.11之前,此WixBundleUILevel是內部屬性,捆綁項目或MSI自定義操作無法訪問。 所以這就是我所做的
在Bundle.wxs中,在我稱之為MSIPackage的位置,我像這樣設置UI_LEVEL屬性
<MsiPackage SourceFile =“ $(var.MsiPath)”> <MsiProperty Name =“ UI_LEVEL” Value =“ [WixBundleUILevel]” /> </ MsiPackage>
然后最后在自定義操作中,我檢查該屬性,例如
int uiLevel;
if (int.TryParse(session["UI_LEVEL"], out uiLevel))
{
if (uiLevel == 4)
using (var form = new WhatsNew())
{
form.ShowDialog();
}
else
session.Log("Skipping What's new dialogue as UI Level is not 4");
}
else
{
session.Log("Couldnt figure out the UI level, so skipped the prompt");
}
最后
here are the possible values of this f**ed up property
WixBundleUILevel Value Burn parameters
BOOTSTRAPPER_DISPLAY_FULL 4 (none)
BOOTSTRAPPER_DISPLAY_PASSIVE 3 /silent
BOOTSTRAPPER_DISPLAY_NONE 2 /quiet
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.