Jump to content
Welcome to our new Citrix community!
  • 0

NGEN error: "mscorlib.dll does not have a native image"

Mike Gallagher


So here's my problem:


While prepping a newly created application layer, NGEN will not complete


"ngen cannot proceed because mscorlib.dll does not have a native image"


This is a new Windows 2019 Datacenter OS Layer. We've been using App Layering for 4 years and have never had this issue.




1.Tried running powershell script suggested here https://discussions.citrix.com/topic/406102-unable-to-finalize os-layer-ngenexe/ 

-Did not resolve the issue


2. Ran a .NET repair

-Did not resolve the issue


3. Ran

DISM /Online /Enable-Feature /FeatureName:NetFx3 /All

DISM /Online /Enable-Feature /FeatureName:NetFx4 /All

-Did not resolve the issue


4. Ran JG Spiers image preparation script:

same errors present when NGEN was running as part of that script

Let script run. Script completed and shut down the VM at after completion

Attempted to finalize the layer. Layer successfully finalized


So my question is:


Am I ok to proceed with this unresolved NGEN error now that the script allows the layer to finalize? I've got a ticket open, but it takes FOREVER to get to a tier that can assist at this level.


Any suggestions are appreciated.


Link to comment

17 answers to this question

Recommended Posts

  • 0
On 9/12/2022 at 5:12 PM, Rob Zylowski1709158051 said:

So just to be sure your running against framework and framework64 correct?  And using ngen eqi 3

Yes. I'm running against both .NET frameworks. Originally using NGEN UPDATE, then using NGEN EQI 3. Support FINALLY got back to me after 11 days and told me to rebuild the OS layer. Punt! Now I'm trying to do that while still fiddling with the one I spent several hours building.


Thanks a lot for your help.

Link to comment
  • 0

so I FINALLY rebuilt this Windows 2019 layer (and all the layers I need to boot a secure VDA after Citrix told me to start all over from scratch . This was MANY hours of work. I had no NGEN issues until I created a layer with some of our in house app prerequisites in it. I run the following NGEN script before shutting down the layers:


C:\Windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe eqi 3
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ngen.exe eqi 3
C:\Windows\Microsoft.NET\Framework\v2.0.50727\ngen.exe update
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\ngen.exe update


NGEN breezes through V4 (both 32 and 64) , but I get the same mscorlib.dll error when it runs against v2.


NGEN EQI 3 doesnt seem to work when run from V2, so I have to stick with NGEN UPDATE there.

Link to comment
  • 0

Thanks for your help (the only help I actually received, since my case just rattled around and I never got to anyone who could answer simple questions about NGEN).


Ultimate solution was 14 hours of work rebuilding EVERY 2019 based layer. It would have been nice if Citrix Support could have helped me with my NGEN issue rather than telling me to redo all that work.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...