有没有办法在安装时捕获自定义操作中的异常?
我正在使用 Visual Studio 2010 创建一个安装文件。我添加了两个自定义操作来在安装过程中传递参数。我构建成功。但在安装过程中出现错误,
以下是错误。
我想跟踪引发此异常的位置。以及具有以下内容的 .dll 文件是什么格式错误。
我正在开发 64 位目标机器的安装文件。
谢谢
I am creating a setup file using visual studio 2010.I have added two custom actions to pass parameters during the installation.I builds successfully.But gives an error during the installation
following is the error.
I want to track the place where this exception get fired.And what is the .dll file which having the bad format.
I'm developing the setup file for 64bit target machine.
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
抛出 BadImageFormatException 的直接原因有以下三个。第一个是您尝试加载为不受支持的不同版本的运行时构建的程序集。例如,StickyNote.dll 是为 .NET 3.5 构建的,但您的项目是针对 .NET 2.0 的。您将收到 BadImageFormatException,因为 2.0 运行时无法加载 3.5 运行时的程序集目标。第二个是您尝试加载非托管程序集(例如非托管 C++ 程序集或 Windows DLL)。第三个是程序集存在严重错误,妨碍了运行时加载程序集的能力。
还有更多可能的原因,但请阅读 MSDN,它列出了所有原因。一般来说,BadImageFormatException 很容易修复。
There are three immediate reasons you will get BadImageFormatException thrown. The first is that you are trying to load an assembly that is built for a different version of the runtime that is not supported. For example, StickyNote.dll was built for .NET 3.5, but your project is targeted for .NET 2.0. You will get a BadImageFormatException because the 2.0 runtime cannot load an assembly target for the 3.5 runtime. The second is you are trying to load an unmanaged assembly (such as an unmanaged C++ assembly or Windows DLL). The third is there is something seriously wrong with the assembly that hendered the runtime's ability to load the assembly.
There are more possible reasons, but read the MSDN it states them all. Generally BadImageFormatException is something simple going on to fix.