System.BadImageFormatException:无法加载文件或程序(从installutil.exe) [英] System.BadImageFormatException: Could not load file or assembly (from installutil.exe)

查看:3283
本文介绍了System.BadImageFormatException:无法加载文件或程序(从installutil.exe)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图安装使用InstallUtil.exe Windows服务,并正在错误消息

  

System.BadImageFormatException:未能加载文件或程序集 {xxx.exe} 或它的某一个依赖。试图用不正确的格式加载程序。

怎么办?


编辑:(没有被OP)从DUP方式获得更多的点击[为googleability]提取的完整信息:

  

C:\ WINDOWS \ Microsoft.NET \ Framework64 \ v4.0.30319> InstallUtil.exe C:\ xxx.exe       微软(R).NET Framework安装实用程序版本4.0.30319.1       版权所有(c)Microsoft公司。保留所有权利。

     

在初始化安装时出现异常:       System.BadImageFormatException:未能加载文件或程序集文件:/// C:\ xxx.exe或它的某一个依赖。试图用不正确的格式加载程序。

解决方案

确认最新的框架(您编译您的应用程序的一种)是第一个在PATH中。这解决了我的问题。这里找到:<一href="http://www.issociate.de/board/post/280574/Installutil_System.BadImageFormatException.html">http://www.issociate.de/board/post/280574/Installutil_System.BadImageFormatException.html

I am trying to install a Windows service using InstallUtil.exe and am getting the error message

System.BadImageFormatException: Could not load file or assembly '{xxx.exe}' or one of its dependencies. An attempt was made to load a program with an incorrect format.

What gives?


EDIT: (Not by OP) Full message extracted from dup getting way more hits [for googleability]:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319>InstallUtil.exe C:\xxx.exe Microsoft (R) .NET Framework Installation utility Version 4.0.30319.1 Copyright (c) Microsoft Corporation. All rights reserved.

Exception occurred while initializing the installation: System.BadImageFormatException: Could not load file or assembly 'file:///C:\xxx.exe' or one of its dependencies. An attempt was made to load a program with an incorrect format..

解决方案

Make sure the newest Framework (the one you compiled your app with) is first in the PATH. That solved the problem for me. Found here: http://www.issociate.de/board/post/280574/Installutil_System.BadImageFormatException.html

这篇关于System.BadImageFormatException:无法加载文件或程序(从installutil.exe)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆