WIX c# CustomAction, what am I doing wrong?
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.TargetNam开发者_StackOverflow社区e).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. I don't believe your call to MessageBox.Show will work. You'll have to rely on the session logging instead.
精彩评论