簡體   English   中英

在WiX中執行任意C#代碼

[英]Executing arbitrary C# code in WiX

我想在WiX安裝程序中運行一些任意代碼,並盡早獲得該結果。

為了測試這一點,我使用返回值設置標簽字段。 它似乎不起作用。 當我放置一個

<Publish Event="DoAction" Value="CustomAction1">1</Publish>

控件中的下一個按鈕,但這太“晚了”。 我希望該代碼一開始就執行。

這是我嘗試過的:

<Binary Id="WixCustomActions" SourceFile="$(var.SolutionDir)$(var.CAProjectName)\bin\Release\$(var.CAProjectName).CA.dll" />

<CustomAction Id="CustomAction1" BinaryKey="WixCustomActions" DllEntry="CustomAction1" Execute="deferred" Return="asyncWait"/> (tried many combinations here)`

稍后的.....

<InstallExecuteSequence>
    <Custom Action="CustomAction1" After="InstallInitialize">1</Custom>
</InstallExecuteSequence>

在紙上這應該工作。

我知道自定義操作本身不是問題,因為當放在下一個鍵上時,我得到了期望的結果。

解決辦法是什么?

InstallExecuteSequence表列出了在執行頂級INSTALL操作時執行的操作。 嘗試在InstallUISequence上使用LaunchConditions

<InstallUISequence>
  <Custom Action="Your_Custom_Action"
          After="CostFinalize"
          Overridable="yes">NOT Installed</Custom>
</InstallUISequence>

此代碼在安裝開始時啟動“ Your_Custom_Action”。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM