14
votes

I have a client machine with Windows 7 Professional installed on it. In order to run my latest application, I installed .Net Framework version 4.0 Full, download from here. My application works fine.

However, there is another application developed in .Net framework 3.5. When I try to execute that application, I get an error:

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

I have tried removing .Net framework 4.0 and reinstalling it again and I tried repairing it, but nothing seems to work. The error remains.

I have tried installing .Net framework 3.5 separately, but I can't install it since a newer version (4.0) is already installed on the machine.

The application with version 3.5 works fine on other client machines, so I guess the issue is isolated to .Net framework installation on that particular machine.

Is there any way to repair mscorpe.dll or re-install .Net framework 3.5 ?

2
The error has nothing to do with .NET 4.0 so repeatedly installing it isn't going to produce any results. The file is part of the 3.5 framework, it is pre-installed on Win7. It isn't actually the app that fails, it is the C# compiler (csc.exe). Suggesting that this is a bug in the app you are trying to use. Contact the owner of the app for support.Hans Passant
@HansPassant, thanks, but if there is a bug, then why it is working on other machines ?CriketerOnSO
I could guess at it, like it wasn't made to run on a 64-bit operating system. But that's pointless when you can ask the owner and get a real answer.Hans Passant
try sfc /scannow and look if this repairs the DLL.magicandre1981
Did the other application work on THAT machine before you installed .net 4?Ian Ringrose

2 Answers

6
votes

First, verify that the file is corrupt and that it cannot be repaired automatically.

Run:

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

If you see the message:

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

It means that both the file and the backup file that Windows uses to perform the repair are damaged.

Windows cannot automatically repair the file and this particular file is not replaced when you reinstall the .Net 3.5 framework.


To restore the file manually:

  1. Install 7-Zip (the 32-bit x86 version).
  2. Open an administrative command prompt.
  3. Insert a copy of Windows 7 Professional into the DVD drive or mount the ISO image.
  4. Run the following commands from the administrative command prompt.

Take ownership of the file:

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

Grant the necessary permissions to overwrite the file:

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

Replace the file with the original from the installation DVD. Note, that this assumes that the DVD is available on the D: drive. Change the drive letter, if necessary, to suit your setup.

"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

Enter Y when prompted to overwrite the file.


  1. Ensure that the .Net 3.5 Windows feature is enabled and retest your application.

Note: If you don't have access to the Windows installation DVD or ISO you can run the first two commands and then copy mscorpe.dll from another machine running Windows 7 Professional x64. Make sure that you copy it from the C:\Windows\Microsoft.Net\Framework64\v2.0.50727\ folder.

1
votes

Chris O'Neill's answer helped me in resolving my issue, I modified it a bit and here is what I did.

Copied a working mscorpe.dll to local computer from another machine Open Command prompt in administrator mode Execute the following command on command prompt

Commnad:

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

(adjust your paths accordingly) It returned a message like:

SUCCESS: The file (or folder):

"C:\Windows\Microsoft.Net\Framework64\v2.0.50727\mscorpe.dll" now owned by user "loggedInUser".

After that executed the following command to grant privileges. Command:

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

Got the following response.

processed file: C:\Windows\Microsoft.Net\Framework64\v2.0.50727\mscorpe.dll Successfully processed 1 files; Failed processing 0 files

Then I copied the correct file copied from another machine to that location:

xcopy c:\K2PublisherError\mscorpe.dll C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorpe.dll /y

This fixed the error.