Exemplo n.º 1
0
        private static IEnumerable <VisualStudioInstance> GetInstances(VisualStudioInstanceQueryOptions options)
        {
#if NET46
            var devConsole = GetDevConsoleInstance();
            if (devConsole != null)
            {
                yield return(devConsole);
            }

    #if FEATURE_VISUALSTUDIOSETUP
            foreach (var instance in VisualStudioLocationHelper.GetInstances())
            {
                yield return(instance);
            }
    #endif
#endif

#if NETCOREAPP
            foreach (var dotnetSdk in DotNetSdkLocationHelper.GetInstances(options.WorkingDirectory))
            {
                yield return(dotnetSdk);
            }
#endif
        }
Exemplo n.º 2
0
 internal static IEnumerable <VisualStudioInstance> QueryVisualStudioInstances(
     IEnumerable <VisualStudioInstance> instances,
     VisualStudioInstanceQueryOptions options)
 {
     return(instances.Where(i => options.DiscoveryTypes.HasFlag(i.DiscoveryType)));
 }
Exemplo n.º 3
0
 /// <summary>
 ///     Query for Visual Studio instances matching the given options.
 /// </summary>
 /// <remarks>
 ///     Only includes Visual Studio 2017 (v15.0) and higher.
 /// </remarks>
 /// <param name="options">Query options for Visual Studio instances.</param>
 /// <returns>Enumeration of Visual Studio instances detected on the machine.</returns>
 public static IEnumerable <VisualStudioInstance> QueryVisualStudioInstances(
     VisualStudioInstanceQueryOptions options)
 => QueryVisualStudioInstances(GetInstances(options), options);