tags:

views:

645

answers:

2

Good Afternoon,

I am trying to find a way to create an entry point for my C# dll. I am aware of how to call other dlls in c# but cannot find create one. I need this in order to call it in my WiX installer as a customer action. Any help that can be provided will be appreciated.

+4  A: 

All you need to do is mark your method up with the CustomAction attribute.

So:

[CustomAction] 
public static ActionResult MyThing(Session session) 
{ 
  // do your  stuff...
  return ActionResult.Success; 
}

As you are already calling other C# assemblies from WiX, it sounds like you have WiX 3.0, which supports the managed wrappers.

Wim Hollebrandse
Thanks. Worked like a charm.
Scott Boettger
+1  A: 

You cannot create entry points in dlls using C#, the only way to create managed dll with custom entry points is to use Managed C++ (CLI).

You can use the DTF (Deployment Tools Foundation) to create managed custom actions that can be called from WIX.

Shay Erlichmen
shameless-plug: http://sites.google.com/site/robertgiesecke/Home/uploads/unmanagedexports g - Serious, though, I hear that way too often. C++/CLI is a big can of worms in itself..
Robert Giesecke