title: Is there a way to detect the current SDK being used in a .targets MSBuild file?
body: <p>In .NET, you can specify which <a href="https://docs.microsoft.com/en-us/dotnet/core/project-sdk/overview" rel="nofollow noreferrer">.NET project SDK</a> you would like to use by specifying the <code>Sdk</code> attribute on the top-level <code>Project</code> element:</p>
  <pre><code>&lt;Project Sdk=&quot;Microsoft.NET.Web.Sdk&quot;&gt;
  </code></pre>
  <p>I am writing a NuGet package and attempting to find an MSBuild property or item that saves off which SDK is being used. I am not having any luck in the official documentation nor when examining a build in the <a href="https://msbuildlog.com/" rel="nofollow noreferrer">MSBuild Structured Log Viewer</a> in finding one.</p>
  <p>Is there an idiomatic way to identify which Sdk has been selected for a project in an MSBuild .targets file?</p>
  <p>I would have expected a property like</p>
  <pre><code>$(MSBuildProjectSdkName) // &quot;Microsoft.NET.Web.Sdk&quot;
  </code></pre>