繁体   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