Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
238 views
in Technique[技术] by (71.8m points)

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

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
meaMy DocumentsVisual Studio 2008ProjectsConsol
eApplication4ConsoleApplication4inRelease>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
meaMy DocumentsVisual Studio
2008ProjectsConsoleApplication4ConsoleApplication4inReleaseConsoleApplica
tion4.exe
    Compiling assembly C:Documents and Settings
meaMy DocumentsVisual Stud
io 2008ProjectsConsoleApplication4ConsoleApplication4inReleaseConsoleAppl
ication4.exe (CLR v2.0.50727) ...
ConsoleApplication4, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

C:WindowsassemblyNativeImages_v2.0.50727_32System.Webace3bede2f516f9e5bca620ad86cc063>System.Web.ni.dll

They start in C:Windowsassembly 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...