c# - .Net 框架 mscorpe.dll 错误

标签 c# .net winforms dll windows-7

我有一台安装了 Windows 7 Professional 的客户端计算机。为了运行我最新的应用程序,我安装了 .Net Framework 4.0 Full,从 here 下载.我的应用程序工作正常。

不过,还有一个应用是用.Net framework 3.5开发的。当我尝试执行该应用程序时,出现错误:

C:\Windows\Microsoft.Net\Framework64\v2.0.50727\mscorepe.dll is either not designed to run on Windows or it contains an error ...

enter image description here

我曾尝试删除 .Net Framework 4.0 并再次重新安装,并尝试修复它,但似乎没有任何效果。错误仍然存​​在。

我已经尝试单独安装 .Net framework 3.5,但我无法安装它,因为机器上已经安装了较新的版本 (4.0)。

3.5 版的应用程序在其他客户端机器上运行良好,所以我猜这个问题与该特定机器上的 .Net Framework 安装无关。

有什么方法可以修复mscorpe.dll 或重新安装.Net framework 3.5 吗?

最佳答案

首先,确认文件已损坏且无法自动修复。

运行:

sfc /scanfile=C:\Windows\Microsoft.Net\Framework64\v2.0.50727\mscorepe.dll

如果您看到消息:

Windows Resource Protection found corrupt files but was unable to fix some of them.

这意味着Windows用于执行修复的文件和备份文件都已损坏。

Windows 无法自动修复该文件,并且在您重新安装 .Net 3.5 框架时不会替换该特定文件。


手动恢复文件:

  1. Install 7-Zip (the 32-bit x86 version).
  2. Open an administrative command prompt.
  3. 将 Windows 7 Professional 的副本插入 DVD 驱动器或安装 ISO 镜像。
  4. 从管理命令提示符运行以下命令。

获取文件的所有权:

takeown /f C:\Windows\Microsoft.Net\Framework64\v2.0.50727\mscorpe.dll

授予覆盖文件所需的权限:

icacls C:\Windows\Microsoft.Net\Framework64\v2.0.50727\mscorpe.dll /GRANT ADMINISTRATORS:F

用安装 DVD 中的原始文件替换该文件。请注意,这假定 DVD 在 D: 驱动器上可用。如有必要,更改驱动器号以适合您的设置。

"C:\Program Files (x86)\7-Zip\7z.exe" e D:\sources\install.wim -oC:\Windows\Microsoft.Net\Framework64\v2.0.50727\ 4\windows\Microsoft.Net\Framework64\v2.0.50727\mscorpe.dll

提示覆盖文件时输入Y


  1. 确保 .Net 3.5 Windows feature is enabled并重新测试您的应用程序。

注意:如果您无法访问 Windows 安装 DVD 或 ISO,您可以运行前两个命令,然后从另一台运行 Windows 7 Professional x64 的计算机复制 mscorpe.dll .确保从 C:\Windows\Microsoft.Net\Framework64\v2.0.50727\ 文件夹中复制它。

关于c# - .Net 框架 mscorpe.dll 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28592443/

相关文章:

winforms - WinForm面板滚动没有滚动条?

c# - 设置从其他表单可见的控件

c# - 类成员访问的点表示法

c# - Windows 服务的可执行文件的路径

c# - 在文件中查找 C#

c# - 识别图像中的 visio 形状

.net - Visual Studio 分析器 [clr.dll]

c# - 单位圆计算

c# - new String() 不在 C# 中创建新的引用对象?

c# - 使用C#显示powerpoint