C# 尝试运行项目时出错:该模块应包含程序集清单
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12135925/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error while trying to run project:The module was expected to contain an assembly manifest
提问by KF2
When I try to run the project it says:
当我尝试运行该项目时,它说:
Error while trying to run project:could not load file or assembly 'Project.exe' or one of its dependencies.
The module was expected to contain an assembly manifest.
尝试运行项目时出错:无法加载文件或程序集“ Project.exe”或其依赖项之一。
该模块应包含程序集清单。
When I ran the exe from the debug folder I got this error:
当我从调试文件夹运行 exe 时,出现此错误:
application unable to start correctly (0xc000007b)
应用程序无法正确启动 (0xc000007b)
I also reinstalled Visual Studio but it doesn't seem to work!
我也重新安装了 Visual Studio,但它似乎不起作用!
How can I solve my problem?
我该如何解决我的问题?
采纳答案by Hans Passant
The module was expected to contain an assembly manifest
该模块应包含程序集清单
It is a low-level assembly loading problem. The CLR has located a file with the right name but when it tries to load the assembly, it finds out that the file doesn't contain a proper manifest. A .NET assembly must contain a manifest, it contains metadata that describes the assembly, listing the types in the assembly, etc.
这是一个低级程序集加载问题。CLR 找到了一个名称正确的文件,但是当它尝试加载程序集时,它发现该文件不包含正确的清单。.NET 程序集必须包含一个清单,它包含描述程序集的元数据、列出程序集中的类型等。
If you have no clue what EXE or DLL might be the troublemaker then you can use the Fuslogvw.exe utility:
如果您不知道什么 EXE 或 DLL 可能是麻烦制造者,那么您可以使用Fuslogvw.exe 实用程序:
- Start it from the "Visual Studio Command Prompt".
- Click the "Settings" button and click the "Log binding failures to disk" radio button.
- Switch back to VS and start the program and wait for the exception to occur.
- Back to Fuslogvw, click the "Refresh" button and double-click the added entry.
- It shows you the file it found.
- 从“Visual Studio 命令提示符”启动它。
- 单击“设置”按钮,然后单击“将日志绑定失败记录到磁盘”单选按钮。
- 切换回VS,启动程序,等待异常发生。
- 回到 Fuslogvw,单击“刷新”按钮并双击添加的条目。
- 它向您显示它找到的文件。
Several possibilities, a common one these days is to trying to load a .NET 4 assembly with an EXE that asked for CLR version 2. That requires an app.exe.config file that forces CLR 4 to be used.
几种可能性,如今常见的一种是尝试使用要求 CLR 版本 2 的 EXE 加载 .NET 4 程序集。这需要强制使用 CLR 4 的 app.exe.config 文件。
回答by Wim Ombelets
0xc000007b is "STATUS_INVALID_IMAGE_FORMAT". From experience, this points me to the project properties. A few things worth checking out:
0xc000007b 是“STATUS_INVALID_IMAGE_FORMAT”。根据经验,这将我指向项目属性。有几件事值得一看:
- Check to see if all the build options are set to either x86 or x64, depending on your system architecture, or AnyCPU.
- If you're using dlls, consider whether they were compiled for your target architecture or not. If not, then recompile them accordingly or get them in the right version from wherever you got them.
- Finally, check if your project assembly and loaded assemblies have different names. That seems to make things go boom as well.
- 检查所有构建选项是否设置为 x86 或 x64,具体取决于您的系统架构或 AnyCPU。
- 如果您使用的是 dll,请考虑它们是否是为您的目标架构编译的。如果没有,则相应地重新编译它们,或者从您获得它们的任何地方获取正确的版本。
- 最后,检查您的项目程序集和加载的程序集是否具有不同的名称。这似乎也让事情变得繁荣起来。
回答by Wim Ombelets
In my case I just change Target Framework(.Net Framework 4) in Project Properties. It solves the problem.
就我而言,我只是在项目属性中更改目标框架(.Net Framework 4)。它解决了这个问题。
回答by Mona
IN my case it get fixed by just going to project properties and set-->startup object projectname.program and build->platform target--> x86.
在我的情况下,只需转到项目属性并设置--> 启动对象 projectname.program 和构建-> 平台目标--> x86 即可修复它。
回答by Nizam
i just resolve this by problem by restarting System as well in project properties i set to multi users as well in combo box start option.hope this will help u.
我只是通过重新启动系统以及在我在组合框启动选项中设置为多用户的项目属性来解决这个问题。希望这会对你有所帮助。
回答by Thanh
I have the same problem when I use Vs2012 utimate to publish Asp.net Mvc4, then upload dll to server. I fixed it by build code as Release mode then upload all dll in bin folder to server.
当我使用Vs2012 utimate发布Asp.net Mvc4,然后将dll上传到服务器时,我遇到了同样的问题。我通过构建代码作为发布模式修复了它,然后将 bin 文件夹中的所有 dll 上传到服务器。

