How to call a C# DLL from InstallerClass overrides?

Posted by simpleton on Stack Overflow See other posts from Stack Overflow or by simpleton
Published on 2010-05-04T01:11:03Z Indexed on 2010/05/04 1:18 UTC
Read the original article Hit count: 450

I have a setup and deployment project. In it I have an Installer.cs class, created from the basic Installer Class template.

In the Install override, I have this code taken from http://msdn.microsoft.com/en-us/library/d9k65z2d.aspx.

 public override void Install(IDictionary stateSaver)
        {
            base.Install(stateSaver);
            System.Diagnostics.Process.Start("http://www.microsoft.com");            
        }

Everything works when I install the application, but the problem arises when I try to call anything from an external C# class library that I also wrote.

Example:

public override void Install(IDictionary stateSaver)
        {
            base.Install(stateSaver);
            System.Diagnostics.Process.Start("http://www.microsoft.com");  
            MyLibrary.SomeMethod();
        }

The problem is, I don't believe the library call is actually happening. I tagged the entire process line by line, with EventLog.WriteEvent()s, and each line in the Install override is seemlingly 'hit', putting entries in the event log, but I do not receive any exceptions for the library call SomeMethod(), yet the EventLog entries and other actions inside SomeMethod() are never created nor any of its actions taken.

Any ideas?

© Stack Overflow or respective owner

Related posts about c#

Related posts about windows-installer