How can I call a custom action dll written in managed code (.net) from an installer without using an unmanaged intermediary?
There is support for exactly this in .NET/Windows Installer
Create an assembly using VS.NET. Add an installer class to the project - select 'Add - New Item'. Select intaller class. This class derives from System.Configuration.Install.Installer. It has a number of virtual methods such as Install(). This will be called when by the windows installer engine at install time.
This assembly can then be added to your Windows Installer project as a custom action. The method used to declare the custom action as a .NET installer class depends on the tool you are using to create the installation.
Sorry this is a little brief.
I wish I knew more about your specific situation, but as general piece of advice, you might look into C++/CLI for issues involving unmanaged/managed interoperability:
C++: The Most Powerful Language for .NET Framework Programming
I know from experience that I can "lift" unmanaged code into a C++/CLI project where I can use it from any C#/.NET/managed code, but it sounds like you want to do the opposite: lift managed code into a C++/CLI project, and then link that with some unmanaged code and expose that as a traditional unmanaged DLL (or installer binary). I'm not sure if this is possible in C++/CLI.
The answer to your question depends on how your are authoring your installer.
For Visual Studio setup projects, create an installer class in one of your deployed assemblies. This is covered in the MSDN documentation, eg http://msdn.microsoft.com/en-us/library/d9k65z2d(VS.80).aspx
For Wix projects, you can use DTF to build managed custom actions which have complete access to the contents of the MSI. Wix is available at http://wix.sourceforge.net/.
Jared - Can you provide some information on how you accomplished this?
Blockquote
I wish I knew more about your specific situation, but as general piece of advice, you might look into C++/CLI for issues involving unmanaged/managed interoperability: C++: The Most Powerful Language for .NET Framework Programming I know from experience that I can "lift" unmanaged code into a C++/CLI project where I can use it from any C#/.NET/managed code, but it sounds like you want to do the opposite: lift managed code into a C++/CLI project, and then link that with some unmanaged code and expose that as a traditional unmanaged DLL (or installer binary). I'm not sure if this is possible in C++/CLI.
Blockquote
I am stuck in a problem with this issue right now. I have a project that works in standard mfc VC but I am trying to take it into he c++/cli world. My main issue I am having is that I am failing to load the Interface on the CoCreateInstance() call.