Error 1001. Exception occurred while initalizing the installation

At work, we are using a Visual Studio add-in for .vdproj projects.  It is used for building .msi files.  I upgraded the project from .net 3.5 to .net 4.5.2.  I also updated some other information in the installer project. When I tried to install the new msi, I received this error message:

Error 1001.  Exception occurred while initializing the installation: 
System.BadImageFormatException: Could not load file or assembly 
'file: ///[some path and file .dll] or one of its dependencies.  
This assembly is built by a runtime newer than the currently loaded 
runtime and cannot be loaded.

Error1001a

The error message was not really very clear about the problem.  Naturally, I tried bing and goog.  No luck.  Not even stack overflow had a good answer.  So, we had to earn this one the hard way.  After one of my colleagues found a solution, I thought I should share the answer.

First, the error that was in the windows event log, looked like this:

The description for Event ID 11001 from source MsiInstaller cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer. 

If the event originated on another computer, the display information had to be saved with the event. 

The following information was included with the event: 

Product: [project name and revision] — Error 1001. Error 1001. Exception occurred while initializing the installation:

System.BadImageFormatException: Could not load file or assembly ‘file:///C:\inetpub\wwwroot\[project name]\bin\[file name].dll’ or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded..

Solution

The problem really did have to do with the .net runtime version, but it was pretty hard to find the place to correct it.  Unfortunately, it is buried in this screen:

Error1001b

Find the installer project, and go to the “Detected Dependencies”.  Double-click “Microsoft .NET Framework”.  This will bring-up the “Requirements” screen.  When you click on the “Launch Conditions” for .NET Framework, you will have the option to check the properties.

Error1001c

If the Properties window is not open, you will need to open it.  Now check the “Version” of the dotnet runtime that your (installer) project, is using.

Error1001d

Conclusion

The root cause of this problem, ultimately stemmed from upgrading our project from .NET 3.5 to 4.5.2, but the installer program couldn’t seem to detect this change and therefore did not automatically fix the settings.  Never fear.  Now you know how to find the setting and fix it yourself.

 

Advertisements

About Tim Golisch

I'm a geek. I do geeky things.
This entry was posted in .net, Errors and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s