How to determine if assembly has been ngen'd?

.net, ngen

Solution

You can try to find your assembly in "ngen cache" (C:\Windows\assembly\NativeImages_v2XXXXXXX).

Сached assemblies will have the following format name: [basename].ni.[baseextension].

Problem

How can you determine whether a particular .Net assembly has already been ngen'd or not? I need to check from code. Even invoking the command-line would be fine. At the moment I can't see any way of determining this.

Original source