0

我正在使用 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" />

那是行不通的。我究竟做错了什么?请帮我。

4

1 回答 1

1

您还需要安排自定义操作运行

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

此外,您必须意识到在 MSI 沙箱中运行会限制很多事情。我不相信您对 MessageBox.Show 的调用会起作用。您将不得不依赖会话日志记录。

于 2010-07-07T08:38:39.103 回答