public static bool IsDotnetCoreFromProjectFile(string projectPath, IEnumerable <Guid> projectTypeGuids) { if (projectPath.EndsWith(".csproj", StringComparison.OrdinalIgnoreCase)) { // for dotnet core preview 3 and after // if its .csproj, look for <PackageReference Include="Microsoft.AspNetCore" Version="..." /> return(!projectTypeGuids.Any() && (VsHelper.IncludesReferencePackage(projectPath, "Microsoft.AspNetCore") || IsWebAppFromFolderStruct(projectPath))); } else if (projectPath.EndsWith(".xproj", StringComparison.OrdinalIgnoreCase)) { // for dotnet core preview 2 and before return(IsWebAppFromFolderStruct(projectPath)); } return(false); }
public static bool IsDotnetCoreFromProjectFile(string projectPath, IEnumerable <Guid> projectTypeGuids) { if (projectPath.EndsWith(".csproj", StringComparison.OrdinalIgnoreCase)) { // for csproj, need to 1st make sure its dotnet core ==> !projectTypeGuids.Any() // 2ndly, look for sign of web project // either <PackageReference Include="Microsoft.AspNetCore" Version="..." /> // for dotnet core project created with 2.0 toolings look for "Microsoft.AspNetCore.All" // for preview3 its web.config file return(!projectTypeGuids.Any() && (VsHelper.IncludesReferencePackage(projectPath, "Microsoft.AspNetCore") || VsHelper.IncludesReferencePackage(projectPath, "Microsoft.AspNetCore.All") || IsWebAppFromFolderStruct(projectPath))); } else if (projectPath.EndsWith(".xproj", StringComparison.OrdinalIgnoreCase)) { // for dotnet core preview 2 and before return(IsWebAppFromFolderStruct(projectPath)); } return(false); }