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);
        }
 public FusionInstallReference(InstallReferenceType type, String identifier, String nonCanonicalData)
     : this(InstallReferenceGuid.FromType(type), identifier, nonCanonicalData)
 {
 }