【发布时间】:2011-03-07 05:18:37
【问题描述】:
握紧你的枪!我确实检查了是否所有项目输出都设置为相同的处理器架构(在本例中为 x64)。他们是。那我想做什么呢?
- 为 Autodesk Revit Architecture 2011 x64 编写了一个插件
- 针对 .NET 3.5
- x64
- 创建了一个安装项目
- 创建了一个自定义操作 (
RegisterRevit2011Addin),用于使用提供的 DLL (RevitAddInUtility.dll) 向 Revit 注册插件- 针对 .NET 3.5
- x64
- 为设置项目、构建、安装添加了自定义操作
这是我收到的错误消息:
错误 1001。初始化安装时发生异常: System.BadImageFormatException:无法加载文件或程序集 'RegisterRevit2011, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' 或一 其依赖项。试图加载格式不正确的程序。
为了确定,我创建了一个简单的控制台测试应用程序:
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();
}
}
}
我针对 x64 和 .NET 3.5 编译了这个 - 瞧,它有效!所以我现在可以假设错误出在安装项目的某个地方。我已经在设置项目属性中设置了目标平台,并将启动条件设置为 3.5。
有趣:当我用dumpbin /headers 检查生成的setup.exe 时,它告诉我它是一个x86 进程!
我很确定这一切都在前天工作,所以我有点担心我以某种方式搞砸了我的系统。有什么想法吗?
【问题讨论】:
标签: .net-3.5 visual-studio-2010 64-bit setup-project