Skip to content
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

Update the place for AllowQueryAllRuntimeVersions #281

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions src/MSBuildLocator/MSBuildLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;

#if NETCOREAPP
using System.Runtime.Loader;
#else
using System.Diagnostics;
#endif

namespace Microsoft.Build.Locator
Expand Down Expand Up @@ -43,14 +44,6 @@ public static class MSBuildLocator
/// </summary>
public static bool IsRegistered => s_registeredHandler != null;

/// <summary>
/// Allow discovery of .NET SDK versions that are unlikely to be successfully loaded in the current process.
/// </summary>
/// <remarks>
/// Defaults to <see langword="false"/>. Set this to <see langword="true"/> only if your application has special logic to handle loading an incompatible SDK, such as launching a new process with the target SDK's runtime.
/// </remarks.
public static bool AllowQueryAllRuntimeVersions { get; set; } = false;
YuliiaKovalova marked this conversation as resolved.
Show resolved Hide resolved

/// <summary>
/// Gets a value indicating whether an instance of MSBuild can be registered.
/// </summary>
Expand Down Expand Up @@ -361,7 +354,7 @@ private static IEnumerable<VisualStudioInstance> GetInstances(VisualStudioInstan
#endif

#if NETCOREAPP
foreach (var dotnetSdk in DotNetSdkLocationHelper.GetInstances(options.WorkingDirectory, AllowQueryAllRuntimeVersions))
foreach (var dotnetSdk in DotNetSdkLocationHelper.GetInstances(options.WorkingDirectory, options.AllowQueryAllRuntimeVersions))
yield return dotnetSdk;
#endif
}
Expand Down
10 changes: 10 additions & 0 deletions src/MSBuildLocator/VisualStudioInstanceQueryOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ public class VisualStudioInstanceQueryOptions
/// </summary>
public DiscoveryType DiscoveryTypes { get; set; }

#if NETCOREAPP
/// <summary>
/// Allow discovery of .NET SDK versions that are unlikely to be successfully loaded in the current process.
/// </summary>
/// <remarks>
/// Defaults to <see langword="false"/>. Set this to <see langword="true"/> only if your application has special logic to handle loading an incompatible SDK, such as launching a new process with the target SDK's runtime.
/// </remarks.
public bool AllowQueryAllRuntimeVersions { get; set; } = false;
YuliiaKovalova marked this conversation as resolved.
Show resolved Hide resolved
#endif

/// <summary>
/// Working directory to use when querying for instances. Ensure it is the project directory to pick up the right global.json.
/// </summary>
Expand Down
Loading