Hold your guns! I did check to see if all the project outputs are set to the same processor architecture (in this case, x64). They are. So what am I trying to do?
- Wrote a plugin for Autodesk Revit Architecture 2011 x64
- targets .NET 3.5
- x64
- Created a setup project
- Created a custom action (
RegisterRevit2011Addin
) for registering plugin with Revit using a supplied DLL (RevitAddInUtility.dll
)- targets .NET 3.5
- x64
- added custom action to setup project, build, install
This is the error message I get:
Error 1001. Exception occurred while initializing the installation: System.BadImageFormatException: Could not load file or assembly 'RegisterRevit2011, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Just to be sure, I created a simple console test application:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var register = new RegisterRevit2011Addin.RegisterAddinCustomAction();
Console.WriteLine(register);
register.Context = new System.Configuration.Install.InstallContext();
register.Context.Parameters.Add("assemblypath", typeof(Program).Assembly.Location);
register.Install(new Dictionary<string, string>());
Console.ReadLine();
}
}
}
I compiled this targeting x64 and .NET 3.5 - voilà, it works! So I can now assume the error lies somewhere in the setup project. I have set the target platform in the setup projects properties and also set the Launch condition to 3.5.
Interesting: When I check the resulting setup.exe
with dumpbin /headers
, it informs me that its a x86 process!
I'm pretty sure this all worked the day before yesterday, so I'm kinda worried I messed up my system somehow. Any ideas?