/// <summary> /// Get the manifests from a file. /// </summary> /// <param name="filename">The file to extract the manifests from.</param> /// <returns>The list of manifests.</returns> public static IEnumerable <ExecutableManifest> GetManifests(string filename) { string fullpath = Path.GetFullPath(filename); using (SafeLoadLibraryHandle library = SafeLoadLibraryHandle.LoadLibrary(fullpath, LoadLibraryFlags.LoadLibraryAsImageResource | LoadLibraryFlags.LoadLibraryAsDataFile)) { List <ExecutableManifest> manifests = new List <ExecutableManifest>(); Win32NativeMethods.EnumResourceNames(library, new IntPtr((int)ResType.MANIFEST), (a, b, c, d) => { try { manifests.Add(new ExecutableManifest(library, fullpath, c)); } catch (Win32Exception) { } catch (ArgumentException) { } return(true); }, IntPtr.Zero); return(manifests); } }