My solution has 3 projects with a project for CustomInstaller, a project for my WPF app and my Setup Installer.
After building my setup installer and running it, in the middle of the process I do have the error message:
Error 1001. Unable to get installer types in the C:\Miopro\MS4\Miopro.Setup.Prerequisites.dll assembly. –> Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Here is my Visual Studio 2022 Solution:
- Miopro.Setup.Prerequisites
- Class Library
- .Net 7.0
- Platform Target x86
- Miopro.Suite.Wpf
- WPF Windows Application
- .Net 7.0
- Platform Target x86
- Miopro.Setup
- Windows Installer Setup Project
- Configuration Active (Debug)
- Configuration Manager has al projects with Platform Any CPU
- File System on Target Machine
- Application Folder Default Location: C:[Manufacturer]\MS4
- Application Folder
- Primary output from Miopro.Setup.Prerequisites
- Publish Items from Miopro.Setup.Prerequisites
- Publish Items from Miopro.Suite.Wpf
- Custom Actions
- Install
- Primary output from Miopro.Setup.Prerequisites
- Install
Environment:
File System
CustomInstaller class
using System;
using System.ComponentModel;
using System.Configuration.Install;
using System.Diagnostics;
using System.IO;
namespace Miopro.Setup.Prerequisites
{
[RunInstaller(true)]
public class CustomInstaller : Installer
{
public CustomInstaller() : base()
{
this.Committed += new InstallEventHandler(CustomInstaller_Committed);
this.Committing += new InstallEventHandler(CustomInstaller_Committing);
}
public static void Main()
{
WriteToEventLog("Install");
}
/// <summary>
/// Event handler for 'Committing' event.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void CustomInstaller_Committing(object sender, InstallEventArgs e)
{
WriteToEventLog("Committing Event occurred.");
}
/// <summary>
/// Event handler for 'Committed' event.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void CustomInstaller_Committed(object sender, InstallEventArgs e)
{
WriteToEventLog("Committed Event occurred.");
}
public override void Install(System.Collections.IDictionary stateSaver)
{
base.Install(stateSaver);
}
/// <summary>
///
/// </summary>
/// <param name="savedState"></param>
public override void Commit(System.Collections.IDictionary savedState)
{
base.Commit(savedState);
}
/// <summary>
///
/// </summary>
/// <param name="savedState"></param>
public override void Rollback(System.Collections.IDictionary savedState)
{
base.Rollback(savedState);
}
/// <summary>
///
/// </summary>
/// <param name="savedState"></param>
public override void Uninstall(System.Collections.IDictionary savedState)
{
base.Uninstall(savedState);
}
private static void WriteToEventLog(string message)
{
string source = "Miopro.Setup.Prerequisites.CustomInstaller";
string log = "Application";
if (!EventLog.SourceExists(source))
{
EventLog.CreateEventSource(source, log);
}
EventLog.WriteEntry(source, message, EventLogEntryType.Information);
}
}
}
So, when I’m installing I can see my Miopro.Setup.Prerequisites.dll on my Application Folder Default Location, so it is available.
I already ready a few of the post over here, but none of them are talking about CustomInstaller on Custom Actions. What´s is the possible reason to get this error message?