Ngen failing to install after unistall

AthaG 21 Reputation points
2022-09-16T14:28:23.37+00:00

Hi,
I am trying to ngen few microsoft dlls due to error in our application while loading. The error happened due to bad image popup in the DeviceGuard enabled environment. So I thought of uninstalling and install native image dll again. I used the following command,

ngen.exe uninstall "Microsoft.WSMan.Management" (it got succeeded)

ngen.exe install "Microsoft.WSMan.Management" This command failed to find the file with the below error,

Failed to compile Microsoft.WSMan.Management because of the following error: The system cannot find the file specified. (Exception from HRESULT: 0x80070002).
Uninstalling assembly Microsoft.WSMan.Management because of an error during compilation: Failed to compile Microsoft.WSMan.Management because of the following error: The system cannot find the file specified. (Exception from HRESULT: 0x80070002).
The system cannot find the file specified. (Exception from HRESULT: 0x80070002)

Can someone help me here?

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,367 questions
0 comments No comments
{count} votes

Accepted answer
  1. Michael Taylor 47,966 Reputation points
    2022-09-16T14:55:04.327+00:00

    You should never ngen binaries you don't own. This is just asking for corrupting your system. Furthermore when those binaries are updated by the third party next time then they won't be ngen automatically which could cause failures or bad performance. Specifically dependencies are impacted by ngen so doing this on binaries you don't own can cause them to fail to load for others.

    At this point you'll need to repair the installation of the program(s) that installed the binaries. The particular one you mentioned is from Powershell so you might be able to repair the installation of it. If you have PS and PS Core then you might need to repair both. If that doesn't fix it then repair the .NET installation as well.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful