Search code examples
vsix

Detect a dotnet core project from EnvDTE.Project API


I try to figure out if the current project (e.g. dte.ActiveSolutionProjects[0]) is a .NET core project.

From the XML of the csproj file it can be told by looking at the project node attributes:

a) Normal .NET

<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

b) donet Core:

<Project Sdk="Microsoft.NET.Sdk">

But how to get that information from the Project API?

I could not find hint looking at the MSDN docs (they target Visual Studio 2015) or exploring the API while debugging...


Solution

  • You should be able to use

    Project.Kind
    

    C# .NET Project: {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}

    C# dotnet Core Project: {9A19103F-16F7-4668-BE54-9A1E7A4F7556}