XDocumentExtensions.

GetSdk(XDocument) Method

Summary

Returns the SDK identifier from the project's root element, supporting both the <Project Sdk="..."> attribute form and the <Project><Sdk Name="..." /></Project> child-element form (per #267 — common in monorepos that hide reusable SDK configuration in Directory.Build.props).

Syntax

public static string GetSdk(this XDocument document)

Parameters

Name Type Description
document XDocument the document

Return Value

Type Description
string the SDK identifier or null if no Sdk attribute or element is set