Tôi đã sử dụng NGEN để tạo hình ảnh gốc của một số cụm được ứng dụng của tôi sử dụng. Tuy nhiên, những hình ảnh đó không được tải khi chạy ứng dụng và tôi không biết tại sao.Hình ảnh gốc .NET được tạo bằng NGEN không được tải
Đây là một nhật ký điển hình từ 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.
Và thông tin từ ngen.exe về lắp ráp rằng:
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
tôi đã sử dụng ngen.exe nằm trong C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ và khung mục tiêu của assembly của tôi là .NET Framework 4. Tôi không biên dịch lại assembly sau khi đã tạo ra hình ảnh gốc.
Mọi trợ giúp sẽ được đánh giá cao.
Tuyệt vời, cảm ơn câu trả lời nhanh và chính xác Hans. – Odsh
+1 cho một câu hỏi được viết rất tốt, bạn đã giúp bạn dễ dàng giúp bạn. –