dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
https://docs.microsoft.com/visualstudio/msbuild/msbuild
MIT License
5.22k stars 1.35k forks source link

Cannot query SdkResolvers for available SDKs #2636

Open mhutch opened 7 years ago

mhutch commented 7 years ago

I have a VS for Mac extension that provides IntelliSense for MSBuild. I'm able to use SdkResolvers to resolve SDKs, but there's no way to query a resolver for the SDKs that it can resolve, which makes it ~impossible to implement good IntelliSense for Sdk attribute values.

AndyGerlicher commented 7 years ago

I'm not sure this would be the right solution. The SdkResolver should be more of an internal construct not something we would expose. Somewhat similar to MSBuildExtensionsPath, but that aspect of it (not knowing the path) is one of our perceived benefits of the SdkResolver design. Ideally these are packages coming from NuGet, but that didn't make 15.5. Hopefully the next bigger release. At that point it would be any NuGet package of the SDK package type. I'm not really sure how that would work with a query for packages it can resolve. And to be clear the good intellisense is for the SDK name not code right?

mhutch commented 7 years ago

The IntelliSense in this case is for the SDK name (though my extension also resolves the SDK and scans it to infer available item and property names). Right now I have very simple Sdk name IntelliSense that just scans for folders in the main Sdks directory. The problem is that none of the .NET Core SDKs show up, nor does my MonoUE SDK, since they both are installed elsewhere on the local filesystem and resolved via resolvers.

I'm fine with the NuGet SdkResolver not being able to provide a list of names that it can resolve, I can query the NuGet feeds and add those items into the list myself. But not all Sdks will necessarily be on NuGet, so I want resolvers that resolve locally to be able to tell me what SDKs exist in the locations from which they resolve.

xtmq commented 5 years ago

+1 Rider team also needs an API to enumerate all installed SDKs. Unlike Visual Studio, Rider can work with different MsBuilds installed on the machine. We detect them all and try to guess which one fits better for the particular solution. But without knowledge about local SDKs we can not implement this in a right way...