Creating an entry point in a C# DLL to call from WIX
-
19-09-2019 - |
Question
I am trying to find a way to create an entry point for my C# DLL. I am aware of how to call other DLL's in C# but cannot find how to create one. I need this in order to call it in my WiX installer as a customer action.
Solution
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.
OTHER TIPS
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.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow