WIX c#CustomAction,我做错了什么?
我正在使用VS2010和WIX3.5 1) 我创建了WIX安装项目 2) 然后我将其添加到解决方案C#custom action项目中,并称之为“CustomActions”WIX c#CustomAction,我做错了什么?,c#,wix,custom-action,wix3.5,dtf,C#,Wix,Custom Action,Wix3.5,Dtf,我正在使用VS2010和WIX3.5 1) 我创建了WIX安装项目 2) 然后我将其添加到解决方案C#custom action项目中,并称之为“CustomActions” namespace CustomActions { public static class CustomActions { [CustomAction] public static ActionResult CustomAction1(Session session) {
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的电话。节目会成功的。您将不得不依赖会话日志记录。如果他引用了名称空间System.Windows.Forms,并且添加了指令“Using System.Windows.Forms”,则对MessageBox.Show()的调用将起作用。我对其进行了测试,它似乎确实起作用。我认为这不是一个好主意,但无论如何都能完成任务。:)您应该使用session.Message来显示消息,否则您无法保证消息框在没有更多编码的情况下位于顶部