<p>How can I call a custom action dll written in managed code (.net) from an installer without using an unmanaged intermediary?</p>

[{'answer_id': 35091, 'author': 'jmatthias', 'author_id': 2768, 'author_profile': 'https://Stackoverflow.com/users/2768', 'pm_score': 0, 'selected': False, 'text': "<p>There is support for exactly this in .NET/Windows Installer</p>\n\n<p>Create an assembly using VS.NET.\nAdd an installer class to the project - select 'Add - New Item'. Select intaller class.\nThis 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.</p>\n\n<p>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.</p>\n\n<p>Sorry this is a little brief.</p>\n"}, {'answer_id': 35112, 'author': 'Jared Updike', 'author_id': 2543, 'author_profile': 'https://Stackoverflow.com/users/2543', 'pm_score': 0, 'selected': False, 'text': '<p>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:</p>\n\n<p><a href="http://msdn.microsoft.com/en-us/library/ms379617%28VS.80%29.aspx#vs05cplus_topic12" rel="nofollow noreferrer">C++: The Most Powerful Language for .NET Framework Programming</a></p>\n\n<p>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.</p>\n'}, {'answer_id': 58211, 'author': 'Paul Lalonde', 'author_id': 5782, 'author_profile': 'https://Stackoverflow.com/users/5782', 'pm_score': 2, 'selected': False, 'text': '<p>The answer to your question depends on how your are authoring your installer.</p>\n\n<p>For Visual Studio setup projects, create an installer class in one of your deployed assemblies.  This is covered in the MSDN documentation, eg <a href="http://msdn.microsoft.com/en-us/library/d9k65z2d(VS.80).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/d9k65z2d(VS.80).aspx</a></p>\n\n<p>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 <a href="http://wix.sourceforge.net/" rel="nofollow noreferrer">http://wix.sourceforge.net/</a>.</p>\n'}, {'answer_id': 189999, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p>Jared - Can you provide some information on how you accomplished this?</p>\n\n<blockquote>\n  <p>Blockquote</p>\n</blockquote>\n\n<p><em>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:\nC++: The Most Powerful Language for .NET Framework Programming\nI 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.</em></p>\n\n<blockquote>\n  <p>Blockquote</p>\n</blockquote>\n\n<p>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.</p>\n'}]
['https://Stackoverflow.com/questions/35049', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1807/']