VisualStudio 安装项目:通过 CustomAction BadImageFormatException 部署带有数据库的项目
我有一个项目解决方案,该项目使用 MSSQL 数据库并为此生成 VisualStudio 安装项目。然后我用一个安装程序类创建了另一个项目,该项目应该在安装时部署我的数据库。
当我现在运行我的安装项目并想要安装我的应用程序时,我总是收到错误:
在初始化安装时 发生异常: System.BadImageFormatException:文件 或程序集... \ CustomAction.dll 或 未找到其依赖项之一。这 程序集由一个术语插入 比当前加载的更新 术语,无法加载。
我希望这个错误是可以理解的,我把它从德语翻译成英语......
所以我很感激任何解决这个问题的提示或技巧。
问候
I have a Solution with a Project which uses a MSSQL Database and generated for this a VisualStudio setup projekt. Then i have made another project with an installer class that should deploy my database on the installation.
So I generated the CustomAction Installer class using this Tutorial and also tried this C# Solution which is similar.
When im running now my setup project and want to install my Application i always get an error:
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.
I hope the error is understandable, i translated it from german to englisch ...
So im grateful for any hints or tips to solve this.
regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许这篇文章会有所帮助:
http://msdn.microsoft.com/en-us/ library/k7137bfe(VS.80).aspx
似乎有 2 个可能的原因:
msiexec.exe /i package.msi /l*v "C:\package.log"
Perhaps this article will help:
http://msdn.microsoft.com/en-us/library/k7137bfe(VS.80).aspx
There seems to be 2 possible causes:
msiexec.exe /i package.msi /l*v "C:\package.log"
不使用 InstallUtil(安装程序类)自定义操作的众多原因之一是,当涉及托管进程和正在抖动的 CLR 版本时,它们是“粘性的”。如果 1.1 CA 触发,然后 2.0 触发,它将失败并出现 BadImageFormat 异常。
我真的建议仔细搜索 WiX 部署工具基础。对于托管代码来说,这是一个更好的托管模型,并解决了问题和许多其他问题。
One of the many reasons to not use InstallUtil ( Installer Class ) custom actions is the are "sticky" when it comes to the hosting process and the version of CLR being jitted. If a 1.1 CA fires then a 2.0 fires it'll fail with a BadImageFormat exception.
I really reccomend doing a good search for WiX Deployment Tools Foundation. It's a much better hosting model for your managed code and solves the problem and many others.