简体   繁体   English

使用NGEN创建的.NET本机映像未加载

[英].NET native images created with NGEN are not loaded

I have used NGEN to create native images of several assemblies used by my application. 我已经使用NGEN来创建我的应用程序使用的几个程序集的本机映像。 However, those images are not loaded when running the application and I have no idea why. 但是,运行应用程序时不会加载这些图像,我不知道为什么。

This is a typical log from fuslogvw: 这是来自fuslogvw的典型日志:

*** Assembly Binder Log Entry  (2/05/2012 @ 13:29:04) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable  C:\MyDir\MyApp.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: User = ***\***
LOG: DisplayName = MyAssembly, Version=1000.0.0.0, Culture=neutral, PublicKeyToken=null (Fully-specified)
LOG: Appbase = file:///C:/MyDir/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MyApp.exe
Calling assembly : PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
LOG: Start binding of native image MyAssembly, Version=1000.0.0.0, Culture=neutral, PublicKeyToken=null.
WRN: No matching native image found.
LOG: IL assembly loaded from C:\MyDir\MyAssembly.dll.

And the information from ngen.exe about that assembly: 以及来自ngen.exe的有关该程序集的信息:

C:\MyDir>ngen display MyAssembly.dll
Microsoft (R) CLR Native Image Generator - Version 4.0.30319.1
Copyright (c) Microsoft Corporation.  All rights reserved.

NGEN Roots:

C:\MyDir\MyAssembly.dll

NGEN Roots that depend on "C:\MyDir\MyAssembly.dll":

C:\MyDir\MyAssembly.dll

Native Images:

MyAssembly, Version=1000.0.0.0, Culture=neutral, PublicKeyToken=null

I used the ngen.exe located in C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\ and my assembly's target framework is .NET Framework 4. I didn't recompile the assembly after having created the native image. 我使用位于C:\\ Windows \\ Microsoft.NET \\ Framework \\ v4.0.30319 \\中的ngen.exe,我的程序集的目标框架是.NET Framework 4.我在创建本机映像后没有重新编译程序集。

Any help would be appreciated. 任何帮助,将不胜感激。

Assembly manager loaded from: C:\\Windows\\Microsoft.NET\\ Framework64 \\v4.0.30319\\clr.dll 程序集管理器从:C:\\ Windows \\ Microsoft.NET \\ Framework64 \\ v4.0.30319 \\ clr.dll加载

Your process is running in 64-bit mode, the default with the AnyCPU target on a 64-bit operating system. 您的进程以64位模式运行,默认情况下是64位操作系统上的AnyCPU目标。 That requires that you run the 64-bit version of ngen.exe. 这要求您运行64位版本的ngen.exe。 Be sure to select the proper Visual Studio Command Prompt. 请务必选择正确的Visual Studio命令提示符。 There are two, the one that sets up the environment for 64-bit tools is named "Visual Studio x64 Win64 Command Prompt (2010)" in the Start menu. 有两个,即为64位工具设置环境的工具在“开始”菜单中命名为“Visual Studio x64 Win64命令提示符(2010)”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM