我有一个项目的解决方案,该项目使用 MSSQL 数据库并为此生成了一个 VisualStudio 安装项目。然后我创建了另一个项目,其中包含一个安装程序类,应该在安装时部署我的数据库。
所以我使用 this 生成了 CustomAction Installer 类教程也试过了this类似的 C# 解决方案。
当我现在运行我的设置项目并想要安装我的应用程序时,我总是收到错误消息:
While initializing the installation an exception occurred: System.BadImageFormatException: File or assembly ... \ CustomAction.dll or one of its dependencies not found. The assembly is inserted by a term that is more recent than the currently loaded term, and can not be loaded.
我希望这个错误是可以理解的,我把它从德语翻译成了英语......
非常感谢您提供解决此问题的任何提示或技巧。
问候
最佳答案
也许这篇文章会有所帮助: http://msdn.microsoft.com/en-us/library/k7137bfe(VS.80).aspx
似乎有两个可能的原因:
- 未正确解析 DLL 路径,因此未找到 DLL。您可以尝试检查 DLL 相对路径是如何根据工作目录解析的。
- 自定义操作有问题。在这种情况下,您可以尝试创建一个日志,看看是否可以找到更多信息。您可以使用 msiexec.exe 创建日志,例如:
msiexec.exe/i package.msi/l*v "C:\package.log"
关于database - VisualStudio 安装项目 : Deploy a Project with Database through a CustomAction BadImageFormatException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4285634/