Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can I find location of generated file after doing Ngen?

Tags:

I did Ngen on a C# executable. It was succesful, but I cannot figure out where the generated file is in my PC. MSDN says it should be in native image cache, still not able to figure out where it is..

EDIT : I want to run objdump on it, hence I need the physical file

EDIT2: my putput of running ngen is :

C:\Documents and Settings\nmea\My Documents\Visual Studio 2008\Projects\Consol eApplication4\ConsoleApplication4\bin\Release>ngen install ConsoleApplication4.e xe Microsoft (R) CLR Native Image Generator - Version 2.0.50727.3053 Copyright (c) Microsoft Corporation.  All rights reserved. Installing assembly C:\Documents and Settings\nmea\My Documents\Visual Studio 2008\Projects\ConsoleApplication4\ConsoleApplication4\bin\Release\ConsoleApplica tion4.exe     Compiling assembly C:\Documents and Settings\nmea\My Documents\Visual Stud io 2008\Projects\ConsoleApplication4\ConsoleApplication4\bin\Release\ConsoleAppl ication4.exe (CLR v2.0.50727) ... ConsoleApplication4, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 
like image 888
paseena Avatar asked Apr 14 '11 01:04

paseena


2 Answers

The exact location will vary by version but it will be something similar to this:

C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Web\ace3bede2f516f9e5bca620ad86cc063>System.Web.ni.dll 

They start in C:\Windows\assembly and then there is a subfolder NativeImages_vXXX for each .NET version. Then there is a subfolder for each dll that has a native image. Under that another subfolder for a unique version identifier (so you can have multiple native images from different versions of the same dll). Finally the native dll itself.

Note that you cannot navigate to this directory in Windows Exlporer. Use cmd. In Explorer there is a shell extension that hides the details of how the GAC and native images work and just shows you a prettier UI.

like image 72
Samuel Neff Avatar answered Oct 27 '22 00:10

Samuel Neff


Just exploring some similar issues here and you can navigate the GAC in explorer if you make a change in the registry.

Under HKEY_LOCAL_MACHINE\Software\Microsoft\Fusion create a DWORD entry named DisableCacheViewer, and set it to 1.

After that, open a new explorer window and navigate to e.g. c:\windows\assembly.

like image 24
Tim Barrass Avatar answered Oct 27 '22 00:10

Tim Barrass