New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need extensibility API to compare frameworks with imports #2633

Closed
abpiskunov opened this Issue Apr 21, 2016 · 2 comments

Comments

Projects
None yet
4 participants
@abpiskunov

abpiskunov commented Apr 21, 2016

It seems we need a new API from nuget to take into account framework’s imports when comparing frameworks.

Something like:

FrameworkName GetNearest(Tuple<FrameworkName, IEnumerable> targetFramework, IEnumerable<Tuple<FrameworkName, IEnumerable>> frameworks);

Or if you want to add a new Type for framework that would work too.

@joelverhagen

This comment has been minimized.

Show comment
Hide comment
@joelverhagen

joelverhagen Apr 21, 2016

Member

Spoke Anton offline. The imports of the project that is the dependency are not relevant. imports are only relevant on the consuming project. Therefore, the API will look like this

namespace NuGet.VisualStudio
{
    /// <summary>
    /// Contains methods to discover frameworks and compatibility between frameworks.
    /// </summary>
    public interface IVsFrameworkCompatibility2 : IVsFrameworkCompatibility
    {
        /// <summary>
        /// Selects the framework from <see cref="frameworks"/> that is nearest
        /// to the <see cref="targetFramework"/>, according to NuGet's framework
        /// compatibility rules. <c>null</c> is returned of none of the frameworks
        /// are compatible.
        /// </summary>
        /// <param name="targetFramework">The target framework.</param>
        /// <param name="fallbackTargetFrameworks">
        /// Target frameworks to use if the provided <see cref="targetFramework"/> is not compatible.
        /// These fallback frameworks are attempted in sequence after <see cref="targetFramework"/>.
        /// </param>
        /// <param name="frameworks">The list of frameworks to choose from.</param>
        /// <exception cref="ArgumentException">If any of the arguments are <c>null</c>.</exception>
        /// <returns>The nearest framework.</returns>
        FrameworkName GetNearest(
            FrameworkName targetFramework,
            IEnumerable<FrameworkName> fallbackTargetFrameworks,
            IEnumerable<FrameworkName> frameworks);
    }
}
Member

joelverhagen commented Apr 21, 2016

Spoke Anton offline. The imports of the project that is the dependency are not relevant. imports are only relevant on the consuming project. Therefore, the API will look like this

namespace NuGet.VisualStudio
{
    /// <summary>
    /// Contains methods to discover frameworks and compatibility between frameworks.
    /// </summary>
    public interface IVsFrameworkCompatibility2 : IVsFrameworkCompatibility
    {
        /// <summary>
        /// Selects the framework from <see cref="frameworks"/> that is nearest
        /// to the <see cref="targetFramework"/>, according to NuGet's framework
        /// compatibility rules. <c>null</c> is returned of none of the frameworks
        /// are compatible.
        /// </summary>
        /// <param name="targetFramework">The target framework.</param>
        /// <param name="fallbackTargetFrameworks">
        /// Target frameworks to use if the provided <see cref="targetFramework"/> is not compatible.
        /// These fallback frameworks are attempted in sequence after <see cref="targetFramework"/>.
        /// </param>
        /// <param name="frameworks">The list of frameworks to choose from.</param>
        /// <exception cref="ArgumentException">If any of the arguments are <c>null</c>.</exception>
        /// <returns>The nearest framework.</returns>
        FrameworkName GetNearest(
            FrameworkName targetFramework,
            IEnumerable<FrameworkName> fallbackTargetFrameworks,
            IEnumerable<FrameworkName> frameworks);
    }
}
@joelverhagen

This comment has been minimized.

Show comment
Hide comment
@joelverhagen
Member

joelverhagen commented Apr 25, 2016

Closed with NuGet/NuGet.Client#522.

@zhili1208 zhili1208 modified the milestones: 3.5 Beta2, 3.6 Beta Jun 22, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment