title: How to add custom action to wix setup project
body: <p>I have 2 projects in my soliution:</p>
  
  <p>1). Custom action class (CustomAction)</p>
  
  <p>2). Wix setup project (TestSetup)</p>
  
  <p>There is CustomAction.cs in CustomAction project:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.IO;
  using System.Linq;
  using System.Text;
  using Microsoft.Deployment.WindowsInstaller;
  
  namespace CustomAction
  {
      public class CustomActions
      {
          [CustomAction]
          public static ActionResult CustomAction1(Session session)
          {
              File.Create(@"c:\installed.txt");
  
              return ActionResult.Success;
          }
      }
  }
  </code></pre>
  
  <p>Product.wxs:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"&gt;
    &lt;Product Id="*" Name="TestSetup" Language="1033" Version="1.0.0.0" Manufacturer="SB2"
             UpgradeCode="39d922d3-a3f5-4207-b905-124615dda25d"&gt;
      &lt;Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /&gt;
  
      &lt;MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /&gt;
      &lt;MediaTemplate EmbedCab="yes"/&gt;
  
      &lt;Feature Id="ProductFeature" Title="TestSetup" Level="1"&gt;
        &lt;ComponentGroupRef Id="ProductComponents" /&gt;
      &lt;/Feature&gt;
      &lt;InstallExecuteSequence&gt;
        &lt;Custom Action="CustomAction" Before="InstallFinalize" /&gt;
      &lt;/InstallExecuteSequence&gt;
    &lt;/Product&gt;
  
    &lt;Fragment&gt;
      &lt;Directory Id="TARGETDIR" Name="SourceDir"&gt;
        &lt;Directory Id="ProgramFilesFolder"&gt;
          &lt;Directory Id="INSTALLFOLDER" Name="TestSetup" /&gt;
        &lt;/Directory&gt;
      &lt;/Directory&gt;
    &lt;/Fragment&gt;
    &lt;Fragment&gt;
      &lt;ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"&gt;
        &lt;Component Id="result.rtf"&gt;
          &lt;File Id="result.rtf" Source="result.rtf" KeyPath="yes" Checksum="yes" /&gt;
        &lt;/Component&gt;
      &lt;/ComponentGroup&gt;
    &lt;/Fragment&gt;
  
  &lt;Fragment&gt;
      &lt;CustomAction Id='CustomAction' BinaryKey='CustomAction.CA' DllEntry='CustomAction' /&gt;
      &lt;Binary Id='CustomAction.CA' SourceFile='..\CustomAction\bin\Debug\CustomAction.CA.dll' /&gt;
  &lt;/Fragment&gt;  
  &lt;/Wix&gt;
  </code></pre>
  
  <p>Setup project buils without problems, but when I'm trying to run it I get a error message:
  "There is a problem with this Windows Installer package. A DLL required for this install to complete could not be run. Contact your support personnel or package vendor"</p>
  
  <p>I think it's because of incorrect binary source file value.
  Would you to show how to fix it? </p>