[英]WIX c# CustomAction, what am I doing wrong?
I'm using VS2010 and WIX 3.5. 我正在使用VS2010和WIX 3.5。
1) I created WIX Setup Project. 1)我创建了WIX安装项目。
2) Then I added to the solution C# custom action project and called it 'CustomActions' 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) Then I compiled CustomActions project and added reference to it from my setup project. 3)然后,我编译CustomActions项目,并从我的安装项目中添加对它的引用。
4) And finally put into .wxs file: 4)最后放入.wxs文件:
<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. 请帮我。
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. 另外,您还必须注意,在MSI沙箱中运行会限制很多事情。 I don't believe your call to MessageBox.Show will work. 我认为您打给MessageBox.Show的电话不起作用。 You'll have to rely on the session logging instead. 您将不得不依靠会话日志记录。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.