microsoft / MSBuildLocator

An API to locate MSBuild assemblies from an installed Visual Studio location. Use this to ensure that calling the MSBuild API will use the same toolset that a build from Visual Studio or msbuild.exe would.
Other
219 stars 83 forks source link

.NET 7 Preview SDK is not listed #165

Closed WeihanLi closed 2 years ago

WeihanLi commented 2 years ago
var msBuildInstances = MSBuildLocator.QueryVisualStudioInstances().ToArray();
var latestMSBuild = msBuildInstances.OrderByDescending(x => x.Version).First();

image

dotnet --info output:

image

WeihanLi commented 2 years ago

I'm running on .NET 6, it's caused by https://github.com/microsoft/MSBuildLocator/blob/7150a203a1685bdbbd583512926c0d88b22ac31a/src/MSBuildLocator/DotNetSdkLocationHelper.cs#L57-L62

WeihanLi commented 2 years ago

Wondering if we should make it configurable

rainersigwald commented 2 years ago

I don't think exposing configuration for "make it possible to load an SDK that will likely fail immediately" makes sense, but I'm starting to wonder if we should expose configuration for "detect and warn if there's a higher SDK available" somehow. I don't have a great idea for how that would work exactly, though.

WeihanLi commented 2 years ago

@rainersigwald thanks