WIX - Adding a C# custom action code

Yonatan Nir picture Yonatan Nir · Oct 13, 2013 · Viewed 12.5k times · Source

I'm creating a program which is being installed by Wix, using VS 2010 and I've already got the product.wxs ready.

Now I want to add a custom C# action to the installation. I've searched how to do it and found this guide: How do I create fully fledged C# custom actions?

The problem is that I don't understand all the instructions, specifically in this section of the guide: Integrate the C# custom action in Advanced Installer

I've created the Custom Action project but I don't understand how do I tell the setup project to run that custom action and how do I set the action to run at install in the commit phase.

Another related thing. How in the C# code can I get the installation path that the user chose to install to?

Answer

Andres Denkberg picture Andres Denkberg · Oct 13, 2013

That tutorial is for how to use WiX managed custom actions with "Advance Installer", a commercial tool for creating installers.

Here is a good explanation on how to create WiX Custom Actions in C#, to use with the WiX toolset.