WIX c# CustomAction,我做错了什么?

发布于 2024-09-07 04:33:03 字数 828 浏览 1 评论 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" />

那不起作用。我做错了什么?请帮我。

I'm using VS2010 and WIX 3.5.

1) I created WIX Setup Project.

2) Then I added to the solution C# custom action project and called it '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) Then I compiled CustomActions project and added reference to it from my setup project.

4) And finally put into .wxs file:

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

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

That doesn't work. What am I doing wrong? Please help me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

橘虞初梦 2024-09-14 04:33:03

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

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

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

You also need to schedule the custom action to run

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

Also you have to be aware that running in the MSI sandbox limits alot of things. I don't believe your call to MessageBox.Show will work. You'll have to rely on the session logging instead.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文