コード例 #1
0
        private static bool IsEquivalent(FusionAssemblyPortabilityPolicy policy, string reference, string ported)
        {
            bool equivalent;

            FusionAssemblyIdentityComparer.AssemblyComparisonResult result;

            int hr = FusionAssemblyIdentityComparer.DefaultModelCompareAssemblyIdentity(
                reference,
                false,
                ported,
                false,
                out equivalent,
                out result,
                policy.ConfigCookie);

            return(result == FusionAssemblyIdentityComparer.AssemblyComparisonResult.EquivalentFullMatch);
        }
コード例 #2
0
        public void FullKeyAndToken()
        {
            string displayPkt =
                "Goo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=" + StrPublicKeyToken1;
            string displayPk = "Goo, Version=1.0.0.0, Culture=neutral, PublicKey=" + StrPublicKey1;

            bool equivalent;

            FusionAssemblyIdentityComparer.AssemblyComparisonResult result;
            int hr = FusionAssemblyIdentityComparer.DefaultModelCompareAssemblyIdentity(
                displayPkt,
                false,
                displayPk,
                false,
                out equivalent,
                out result,
                IntPtr.Zero
                );

            Assert.Equal(0, hr);
            Assert.True(equivalent, "Expected equivalent");
            Assert.Equal(
                FusionAssemblyIdentityComparer.AssemblyComparisonResult.EquivalentFullMatch,
                result
                );

            hr = FusionAssemblyIdentityComparer.DefaultModelCompareAssemblyIdentity(
                displayPk,
                false,
                displayPkt,
                false,
                out equivalent,
                out result,
                IntPtr.Zero
                );

            Assert.Equal(0, hr);
            Assert.True(equivalent, "Expected equivalent");
            Assert.Equal(
                FusionAssemblyIdentityComparer.AssemblyComparisonResult.EquivalentFullMatch,
                result
                );
        }