Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
860 views
in Technique[技术] by (71.8m points)

.net - 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:empprogram.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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I have never seen that error, but the path c:empprogram.exe is very strange. Are you trying to run the installer from the c:emp 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?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...