Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

CompareAssemblyIdentityWithConfig Function

.NET Framework 4

Updated: May 2011

Compares two assembly identities to determine whether they are equivalent after applying portability policy elements from a specified configuration file.

STDAPI CompareAssemblyIdentityWithConfig (
    [in]  LPCWSTR                  pwzAssemblyIdentity1,
    [in]  BOOL                     fUnified1,
    [in]  LPCWSTR                  pwzAssemblyIdentity2,
    [in]  BOOL                     fUnified2,
    [in]  struct AssemblyConfig    *pAssemblyConfig,
    [out] BOOL                     *pfEquivalent,
    [out] AssemblyComparisonResult *pResult


[in] The textual identity of the first assembly in the comparison.


[in] A Boolean flag that indicates user-specified unification for pwzAssemblyIdentity1.


[in] The textual identity of the second assembly in the comparison.


[in] A Boolean flag that indicates user-specified unification for pwzAssemblyIdentity2.


[in] A configuration file that contains information that affects portability policy, such as the <supportPortability> element.


[out] A Boolean flag that indicates whether the two assemblies are equivalent.


[out] An AssemblyComparisonResult value that contains detailed information about the comparison.

pfEquivalent returns a Boolean value that indicates whether the two assemblies are equivalent. pResult returns one of the AssemblyComparisonResult values, to give a more detailed reason for the value of pfEquivalent.

CompareAssemblyIdentityWithConfig checks whether pwzAssemblyIdentity1 and pwzAssemblyIdentity2 are equivalent. pfEquivalent is set to true if one or more of the following conditions are true after the application of any elements in pAssemblyConfig that affect portability policy:

  • The two assembly identities are equivalent. For strongly named assemblies, equivalency requires the assembly name, version, public key token, and culture to be identical. For simply named assemblies, equivalency requires a match on the assembly name and culture.

  • Both assembly identities refer to assemblies that run on the .NET Framework. This condition returns true even if the assembly version numbers do not match.

  • The two assemblies are not managed assemblies, but fUnified1 or fUnified2 was set to true.

The fUnified flag indicates that all version numbers up to the version number of the strongly named assembly are considered equivalent to the strongly named assembly. For example, if the value of pwzAssemblyIndentity1 is "MyAssembly, version=, culture=neutral, publicKeyToken=....", and the value of fUnified1 is true, this indicates that all versions of MyAssembly from version to should be treated as equivalent. In such a case, if pwzAssemblyIndentity2 refers to the same assembly as pwzAssemblyIndentity1, except that it has a lower version number, pfEquivalent is set to true. If pwzAssemblyIdentity2 refers to a higher version number, pfEquivalent is set to true only if the value of fUnified2 is true.

The pResult parameter includes specific information about why the two assemblies are considered equivalent or not equivalent. For more information, see the AssemblyComparisonResult enumeration.

Platforms: See .NET Framework System Requirements.

Header: Fusion.h

Library: Included as a resource in MsCorEE.dll

.NET Framework Versions: 4




May 2011

Corrected errors in initial documentation.

Customer feedback.

March 2011

Added missing API documentation.

Content bug fix.

Community Additions

© 2015 Microsoft