internal VisualStudioInstance()

in src/MSBuildLocator/VisualStudioInstance.cs [14:36]


        internal VisualStudioInstance(string name, string path, Version version, DiscoveryType discoveryType)
        {
            Name = name;
            VisualStudioRootPath = path;
            Version = version;
            DiscoveryType = discoveryType;

            switch (discoveryType)
            {
                case DiscoveryType.DeveloperConsole:
                case DiscoveryType.VisualStudioSetup:
                    // For VS 16.0 and higher use 'Current' instead of '15.0' in the MSBuild path.
                    MSBuildPath = version.Major >= 16 ?
                        Path.Combine(VisualStudioRootPath, "MSBuild", "Current", "Bin") :
                        Path.Combine(VisualStudioRootPath, "MSBuild", "15.0", "Bin");
                    break;
                case DiscoveryType.DotNetSdk:
                    MSBuildPath = VisualStudioRootPath;
                    break;
                default:
                    throw new ArgumentOutOfRangeException(nameof(discoveryType), discoveryType, null);
            }
        }