I'm learning the Wix to build a installer.
in a custom Dialog, I have a Control, which type is Text, and I have a Button. I want to click the Button to copy the Text into the Clipboard.
Here are the codes. First is the Controls.
<Control Id="AboutUsInfo" Type="Text" Property="AboutUsText"
X="150" Y="20" Width="140" Height="150">
<Text SourceFile="sample\info2.txt" />
</Control>
<Control Id="CopyAboutUsButton" Type="PushButton" Text="Copy to the clipboard"
X="100" Y="180" Width="80" Height="17">
<Publish Event="DoAction" Value="CopyAboutUsAction"></Publish>
</Control>
<Binary Id="Customactions" SourceFile="sample\CustomAction1.CA.dll"></Binary>
Here is the CustomAction.
<CustomAction Id="CopyAboutUsAction" BinaryKey="Customactions" DllEntry="CopyToClipboard" Return="ignore">
</CustomAction>
Now the C# code
namespace CustomAction1
{
public class CustomActions
{
[CustomAction]
public static ActionResult CopyToClipboard(Session session)
{
session.Log("Begin Copy");
String s=session["AboutUsText"];
Clipboard.SetText("this is copy");
return ActionResult.Success;
}
}
}
The Problem is, each time I click the button, my installer says nothing. And nothing happens in my Clipboard. How can I make this work?
msiexec /i package.msi /l*v package.log
. You should see why the installation is aborted in thepackage.log
file. – Alexey Ivanov