2012-05-02 27 views
10

私はNGENを使用して、アプリケーションで使用されるいくつかのアセンブリのネイティブイメージを作成しました。しかし、アプリケーションを実行するときにそれらのイメージが読み込まれず、私は理由を知らない。NGENで作成された.NETネイティブイメージはロードされません

これは典型的な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. 

そして、そのアセンブリに関する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 

私はCに位置ngen.exe使用:\ WINDOWS \をMicrosoft.NET \ Framework \ v4.0.30319 \と私のアセンブリのターゲットフレームワークは.NET Framework 4です。ネイティブイメージを作成した後でアセンブリを再コンパイルしませんでした。

ご協力いただければ幸いです。 C:からロード

答えて

10

アセンブリマネージャ\ WINDOWS \ Microsoft.NET \ Framework64 \ v4.0.30319 clr.dll

あなたのプロセスは、64ビットモードでを使用してデフォルトを実行している\ 64ビットオペレーティングシステム上のAnyCPUターゲットそのためには、の64ビットバージョン(ngen.exe)を実行する必要があります。適切なVisual Studioのコマンドプロンプトを必ず選択してください。 2つあります.64ビットツールの環境を設定するものは、[スタート]メニューの[Visual Studio x64 Win64コマンドプロンプト(2010)]です。

+0

素晴らしい、すばやく正確な答えHansさんに感謝します。 – Odsh

+1

+1非常によく文書化された質問のために、あなたは簡単にあなたを助けました。 –

関連する問題