src/Microsoft.VisualStudio.ProjectSystem.Managed/ProjectSystem/ProjectConfigurationExtensions.cs
/// <summary>
/// Returns true if the given project configurations are equal ignoring the "TargetFramework" dimension.
/// </summary>
Returns true if the given project configurations are equal ignoring the "TargetFramework" dimension.
Returns true if the given project configurations are equal ignoring the " TargetFramework " dimension .
internal static bool EqualIgnoringTargetFramework(this ProjectConfiguration projectConfiguration1, ProjectConfiguration projectConfiguration2)
        {
            Requires.NotNull(projectConfiguration1, nameof(projectConfiguration1));
            Requires.NotNull(projectConfiguration2, nameof(projectConfiguration2));
            if (projectConfiguration1.Dimensions.Count != projectConfiguration2.Dimensions.Count)
            {
                return false;
            }
            if (!projectConfiguration1.IsCrossTargeting() || !projectConfiguration2.IsCrossTargeting())
            {
                return projectConfiguration1.Equals(projectConfiguration2);
            }
            foreach (var dimensionKvp in projectConfiguration1.Dimensions)
            {
                var dimensionName = dimensionKvp.Key;
                var dimensionValue = dimensionKvp.Value;
                if (StringComparers.ConfigurationDimensionNames.Equals(dimensionName, ConfigurationGeneral.TargetFrameworkProperty))
                {
                    continue;
                }
                if (!projectConfiguration2.Dimensions.TryGetValue(dimensionName, out string activeValue) ||
                    !string.Equals(dimensionValue, activeValue, StringComparison.Ordinal))
                {
                    return false;
                }
            }
            return true;
        }
internal static bool EqualIgnoringTargetFramework ( this ProjectConfiguration projectConfiguration1 , ProjectConfiguration projectConfiguration2 ) { Requires . NotNull ( projectConfiguration1 , nameof ( projectConfiguration1 ) ) ; Requires . NotNull ( projectConfiguration2 , nameof ( projectConfiguration2 ) ) ; if ( projectConfiguration1 . Dimensions . Count != projectConfiguration2 . Dimensions . Count ) { return false ; } if ( ! projectConfiguration1 . IsCrossTargeting ( ) || ! projectConfiguration2 . IsCrossTargeting ( ) ) { return projectConfiguration1 . Equals ( projectConfiguration2 ) ; } foreach ( var dimensionKvp in projectConfiguration1 . Dimensions ) { var dimensionName = dimensionKvp . Key ; var dimensionValue = dimensionKvp . Value ; if ( StringComparers . ConfigurationDimensionNames . Equals ( dimensionName , ConfigurationGeneral . TargetFrameworkProperty ) ) { continue ; } if ( ! projectConfiguration2 . Dimensions . TryGetValue ( dimensionName , out string activeValue ) || ! string . Equals ( dimensionValue , activeValue , StringComparison . Ordinal ) ) { return false ; } } return true ; }
Returns true if the given project configurations are equal ignoring the "TargetFramework" dimension.
Returns true if the given project configurations are equal ignoring the " TargetFramework " dimension .
// Ignore the TargetFramework. // Dimension values must be compared in a case-sensitive manner.
ProjectConfiguration
this
projectConfiguration2
ProjectConfiguration