Example #1
0
        private static int GetInstanceFeatureScore(MSBuildInstance i)
        {
            var score = 0;

            if (i.HasDotNetSdksResolvers())
            {
                score++;
            }

            if (i.IsInvalidVisualStudio())
            {
                return(int.MinValue);
            }
            else
            {
                score++;
            }

            if (i.DiscoveryType == DiscoveryType.StandAlone)
            {
                score--;
            }

            return(score);
        }
Example #2
0
        private static int GetInstanceFeatureScore(MSBuildInstance i, Version minimumMSBuildVersion)
        {
            var score = 0;

            // user override gets highest priority
            if (i.DiscoveryType == DiscoveryType.UserOverride)
            {
                return(int.MaxValue);
            }

            if (i.IsInvalidVisualStudio())
            {
                return(int.MinValue);
            }
            else
            {
                score++;
            }

            // dotnet SDK resolvers are mandatory to use a VS instance
            if (i.HasDotNetSdksResolvers())
            {
                score++;
            }
            else
            {
                return(int.MinValue);
            }

            return(score);
        }
Example #3
0
        private static int GetInstanceFeatureScore(MSBuildInstance i)
        {
            var score = 0;

            // user override gets highest priority
            if (i.DiscoveryType == DiscoveryType.UserOverride)
            {
                return(int.MaxValue);
            }

            if (i.HasDotNetSdksResolvers())
            {
                score++;
            }

            if (i.IsInvalidVisualStudio())
            {
                return(int.MinValue);
            }
            else
            {
                score++;
            }

            if (i.DiscoveryType == DiscoveryType.StandAlone)
            {
                score--;
            }

            // VS 2019 should be preferred
            if (i.Version.Major >= 16)
            {
                score++;
            }
            else
            {
                score--;
            }

            return(score);
        }