1
votes

I try to add a custom action to a Installer Project. I added a Custom Action Project with following code:

  public class CustomActions
  {
    [CustomAction]
    public static ActionResult CustomAction1(Session session)
    {
      session.Log("Begin CustomAction1");

      return ActionResult.Success;
    }
  }

In my installer Project, I added a reference to the CustomAction_project and added following entry to Custom Actions -> Install:

Name: Primary output from CustomAction (Active) EntryPoint: CustomAction1 InstallerClass: False SourcePath: Path to CustomAction.dll

Now, if I try to Build my Installer Project I get following Error:

ERROR: Entry point 'CustomAction1' not found in module 'PATH\CustomAction.dll' for custom action 'Primary output from CustomAction (Active)'.

  • What do I wrong? The Custom Action code was automatically generated by Visual Studio 2013!

2

2 Answers

1
votes

You've built a managed code custom action project that's intended for WiX setups. You need an installer class custom action if you are using a native Visual Studio installer project. These might help:

https://msdn.microsoft.com/en-us/library/vstudio/d9k65z2d(v=vs.100).aspx

http://www.c-sharpcorner.com/uploadfile/ddoedens/usinginstallerclassestoeasedeploymentinvs.net12012005061649am/usinginstallerclassestoeasedeploymentinvs.net.aspx

http://vbcity.com/forums/t/145818.aspx

Basically you add an installer class to your project, and override the install method.

0
votes

If you want to use CustomActions from Microsoft.Deployment.WindowsInstaller (not the Installer Class) you need to :

  1. Install the wix toolset from here.
  2. Create a new class Project in VS
  3. Reference the %WiX%SDK\Microsoft.Deployment.WindowsInstaller.dll
  4. Create a class like this.
  5. Compile.
  6. The result of compilation should be a projectName.dll and projectName.CA.dll, the projectName.CA.dll must be included in your setup project like this:

enter image description here

Happy Installing... :)