Summary
Project files can contain <Sdk> elements (modeled by ProjectSdkElement).
For parity with other project contents, there should be a property to access only those elements (e.g. SdkReferences).
Background and Motivation
There are already properties for accessing the Sdk attribute, all properties, all imports and all items.
However, while Sdk elements appear in Children, they have no dedicated convenience accessor of their own.
Proposed Feature
/// <summary>
/// Get a read-only collection of the SDK references.
/// </summary>
public ICollection<ProjectSdkElement> Sdks => new ReadOnlyCollection<ProjectSdkElement>(Children.OfType<ProjectSdkElement>());
(name could also be SdkElements for better distinction from Sdk; there is also ChooseElements)
(using Children and not AllChildren because I assume these elements are only valid at the top level)
A nice-to-have additional property (SdkReferences) or method (GetSdkReferences()) would be one that gathers all SDK references in a project, from all sources:
Sdk attribute on the project
Sdk elements
Import elements that specify an SDK
(That would make it easy for something like Dependabot to check whether a particular project references an SDK package for which an update is available.)
Alternative Designs
No response
Summary
Project files can contain
<Sdk>elements (modeled byProjectSdkElement).For parity with other project contents, there should be a property to access only those elements (e.g.
SdkReferences).Background and Motivation
There are already properties for accessing the
Sdkattribute, all properties, all imports and all items.However, while
Sdkelements appear inChildren, they have no dedicated convenience accessor of their own.Proposed Feature
(name could also be
SdkElementsfor better distinction fromSdk; there is alsoChooseElements)(using
Childrenand notAllChildrenbecause I assume these elements are only valid at the top level)A nice-to-have additional property (
SdkReferences) or method (GetSdkReferences()) would be one that gathers all SDK references in a project, from all sources:Sdkattribute on the projectSdkelementsImportelements that specify an SDK(That would make it easy for something like Dependabot to check whether a particular project references an SDK package for which an update is available.)
Alternative Designs
No response