簡體   English   中英

WIX c#CustomAction,我在做什么錯?

[英]WIX c# CustomAction, what am I doing wrong?

我正在使用VS2010和WIX 3.5。

1)我創建了WIX安裝項目。

2)然后,我將其添加到解決方案C#自定義操作項目中,並將其稱為“ CustomActions”

 namespace CustomActions
 {
   public static class CustomActions
   {
     [CustomAction]
     public static ActionResult CustomAction1(Session session)
     {
         Debugger.Break();
         MessageBox.Show("It works");
         session.Log("Begin CustomAction1");
         return ActionResult.Success;
     }
   }
 }

3)然后,我編譯CustomActions項目,並從我的安裝項目中添加對它的引用。

4)最后放入.wxs文件:

 <Binary Id="CustomActions"  SourceFile="$(var.CustomActions.TargetDir)$(var.CustomActions.TargetName).CA.dll"/>

 <CustomAction Id="CustomAction1" BinaryKey="CustomActions" DllEntry="CustomAction1" Execute="immediate" />

那不行 我究竟做錯了什么? 請幫我。

您還需要安排自定義操作運行

   <InstallUISequence>
      <Custom Action="CustomAction1" After="AppSearch"/>
   </InstallUISequence>

另外,您還必須注意,在MSI沙箱中運行會限制很多事情。 我認為您打給MessageBox.Show的電話不起作用。 您將不得不依靠會話日志記錄。

暫無
暫無

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

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