public static IEnumerable <InstallReference> GetInstallReferences(AssemblyName assemblyName) { IAssemblyName fusionAssemblyName = null; ComCheck(FusionApi.CreateAssemblyNameObject(out fusionAssemblyName, assemblyName.GetFullyQualifiedName(), CreateAssemblyNameObjectFlags.ParseDisplayName, IntPtr.Zero)); IInstallReferenceEnum installReferenceEnum = null; ComCheck(FusionApi.CreateInstallReferenceEnum(out installReferenceEnum, fusionAssemblyName, 0, IntPtr.Zero)); IInstallReferenceItem item = null; do { int hResult = installReferenceEnum.GetNextInstallReferenceItem(out item, 0, IntPtr.Zero); if ((uint)hResult == 0x80070103) // ERROR_NO_MORE_ITEMS { yield break; } ComCheck(hResult); IntPtr refData; ComCheck(item.GetReference(out refData, 0, IntPtr.Zero)); FusionInstallReference fusionReference = new FusionInstallReference(); Marshal.PtrToStructure(refData, fusionReference); var reference = new InstallReference(InstallReferenceGuid.ToType(fusionReference.GuidScheme), fusionReference.Identifier, fusionReference.NonCanonicalData); yield return(reference); } while (true); }
internal static extern int CreateInstallReferenceEnum( out IInstallReferenceEnum ppRefEnum, IAssemblyName pName, int dwFlags, IntPtr pvReserved);
public static extern HRESULT CreateInstallReferenceEnum(out IInstallReferenceEnum installReferenceEnum, IAssemblyName assemblyName, CreateInstallReferenceFlags flags, int reserved);
private static extern void CreateInstallReferenceEnum(out IInstallReferenceEnum ppRefEnum, IAssemblyName pName, uint dwFlags, IntPtr pvReserved);
public static extern void CreateInstallReferenceEnum(out IInstallReferenceEnum ppRefEnum, IAssemblyName pName, uint dwFlags, IntPtr pvReserved);