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.24k stars 1.35k forks source link

Support packages/custom Sdks to provide their own XSD #11026

Open Youssef1313 opened 6 days ago

Youssef1313 commented 6 days ago

Summary

Today, csproj IntelliSense is only driven by XSDs provided by MSBuild. I think it would be nice to have some sort of extensibility and allow NuGet packages and/or custom MSBuild Sdks to provide their own XSD.

Background and Motivation

Many NuGet packages (regular ones and Sdks) offer some MSBuild properties intended for use by consumers. Today, first-party authors have to make the change in this repo, and third-party authors have no way to do it (assuming they don't go too crazy and grab the XSD from VS installation and attempt to modify it).

Proposed Feature

Not sure if the exact shape or technical limitations here, but having something like Sdk.xsd (like Sdk.props and Sdk.targets that are special cased for custom Sdks) would be nice. For regular NuGet packages, it could be build\<PackageName>.xsd.

Any other design that solves the problem is also good.

Alternative Designs

No response

Evangelink commented 5 days ago

cc @YuliiaKovalova @JanKrivanek @rainersigwald

KalleOlaviNiemitalo commented 4 days ago

Ideas:

General problem: PackageReference conditional on TargetFramework. If the project is multitargeted and different target frameworks use different versions of the same package, then which version of the XML schema should be used by the XML editor?

General problem: if the VS user opens a file that is imported to multiple projects that reference packages that carry MSBuild XML schema files, how does VS choose the project whose package references should control the schemata in the XML editor?

Youssef1313 commented 4 days ago

General problem: if the VS user opens a file that is imported to multiple projects that reference packages that carry MSBuild XML schema files, how does VS choose the project whose package references should control the schemata in the XML editor?

Good question. I think that should be a merge of everything. In case of conflicts, it could show the property multiple times. For example, MyProperty (package ... version ...), then the tooltip for each of these can have the description from the specific package.