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

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

问题描述

我正在尝试使用 InstallUtil.exe 安装 Windows 服务并收到错误消息

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

System.BadImageFormatException: 无法加载文件或程序集{xxx.exe}"或其依赖项之一.试图加载格式不正确的程序.

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.

是什么?

(不是 OP)从 dup 中提取的完整消息获得了更多的点击率 [为了 googleability]:

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

C:WindowsMicrosoft.NETFramework64v4.0.30319>InstallUtil.exe C:xxx.exeMicrosoft (R) .NET Framework 安装实用程序版本 4.0.30319.1版权所有 (c) 微软公司.保留所有权利.

C:WindowsMicrosoft.NETFramework64v4.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.

初始化安装时发生异常:System.BadImageFormatException: 无法加载文件或程序集file:///C:xxx.exe"或其依赖项之一.试图加载格式不正确的程序..

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..

推荐答案

确保最新的框架(您编译应用程序的框架)是 PATH 中的第一个.那为我解决了问题.(找到 在论坛上)

Make sure the newest Framework (the one you compiled your app with) is first in the PATH. That solved the problem for me. (Found on a forum)

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

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