user26901
user26901

Reputation:

Error with Windows Installer ... "Unable to get installer types"

I'm experiencing an error when using the windows installer to install an event source in a product I am deploying.

The error message I receive states the following ...

Unable to get installer types in the c:\temp\program.exe assembly. --> Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

Here is the block of code that creates the event source installer ...

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Diagnostics;

namespace myapplication
{
    [RunInstaller(true)]
    public partial class EventSourceInstaller : Installer
    {
        public EventSourceInstaller()
        {
            InitializeComponent();

            string eventSourceName = "MyAppSourceName";
            if (!EventLog.SourceExists(eventSourceName))
            {
                EventSourceCreationData data = new EventSourceCreationData(eventSourceName, "Application");
                EventLog.CreateEventSource(data);
                EventLog.WriteEntry(eventSourceName, "Source Added.");
            }
        }
    }
}

In the installer project I've added a custom action on Install named "Primary output from MyApplication (Active)" to run the event source installer.

I have the following questions

  1. Has anyone else run across this and what was the issue?

  2. How do I go about retrieving the LoaderExceptions property of the installer?

Upvotes: 7

Views: 26134

Answers (7)

Nivrutti Anande
Nivrutti Anande

Reputation: 11

Following things works for me

  1. Clean Solution
  2. Close and restart visual studio
  3. Rebuild the solution

Upvotes: 1

Simon Houlton
Simon Houlton

Reputation: 182

I was getting the same exception when trying to install a windows service. I tried the above but was simply copying a service from our dev environment to our live and I didn't realise the targeted version of .net was missing from the live server.

Upvotes: 0

Shabtay Fischer
Shabtay Fischer

Reputation: 11

I had the same problem. The solution was to copy to the service's folder all dll's etc. from the bin\debug or bin\release folder

Upvotes: 0

LawMan
LawMan

Reputation: 3625

My problem was that I was using the 64 bit version of installutil.exe instead of the 32 bit version.

  • 32 bit path - C:\Windows\Microsoft.NET\Framework\v4.0.30319

  • 64 bit path - C:\Windows\Microsoft.NET\Framework64\v4.0.30319

Upvotes: 0

Philipp
Philipp

Reputation: 21

The "Detected Dependencies" of your setup project are not up to date. In my case refreshing the dependencies does not work. Due to adding an dll to the setup project dependencies visual studio refreshed them all. After rebuilding the setup project and the error didn't occurred any more!

Upvotes: 2

erikkallen
erikkallen

Reputation: 34391

I had exactly the same problem.

I guess your program is referencing other DLLs which the installer install in the GAC or somewhere else outside of the application directory. You can't count on those DLLs being installed before your install action runs.

Solution: Create a separate DLL for your install action and make sure that DLL does not reference any other DLL (directly or indirectly) that are not installed inside your application folder.

BTW, if you can, switch to some other technology. I don't know which competitors are better, but if you do non-standard stuff, the VS install project will cause you nothing but trouble.

Upvotes: 2

Dour High Arch
Dour High Arch

Reputation: 21712

I have never seen that error, but the path c:\temp\program.exe is very strange. Are you trying to run the installer from the c:\temp\ directory?

Are you certain the output of all projects and all third-party DLLs you use are included in the Deployment project? Click on all included files in the Deployment project and check their SourcePath property; are they to the original source files and not the target output folder? Not the temp folder?

Upvotes: 3

Related Questions