diff --git a/src/Microsoft.VisualStudio.SlnGen.UnitTests/SlnProjectTests.cs b/src/Microsoft.VisualStudio.SlnGen.UnitTests/SlnProjectTests.cs index 1a11a60..989d15f 100644 --- a/src/Microsoft.VisualStudio.SlnGen.UnitTests/SlnProjectTests.cs +++ b/src/Microsoft.VisualStudio.SlnGen.UnitTests/SlnProjectTests.cs @@ -111,7 +111,9 @@ public void GetProjectTypeGuidLegacyProject(string extension) case ProjectFileExtensions.VisualBasic: actualProject.ProjectTypeGuid.ShouldBe(new Guid("F184B08F-C81C-45F6-A57F-5ABD9991F28F")); break; - + case ProjectFileExtensions.SqlServerDb: + actualProject.ProjectTypeGuid.ShouldBe(new Guid("00D1A9C2-B5F0-4AF3-8072-F6C62B433612")); + break; default: actualProject.ProjectTypeGuid.ShouldBe(SlnProject.KnownProjectTypeGuids[extension]); break; @@ -148,6 +150,10 @@ public void GetProjectTypeGuidSdkProject(string extension) actualProject.ProjectTypeGuid.ShouldBe(new Guid("778DAE3C-4631-46EA-AA77-85C1314464D9")); break; + case ProjectFileExtensions.SqlServerDb: + actualProject.ProjectTypeGuid.ShouldBe(new Guid("42EA0DBD-9CF1-443E-919E-BE9C484E4577")); + break; + default: actualProject.ProjectTypeGuid.ShouldBe(SlnProject.KnownProjectTypeGuids[extension]); break; diff --git a/src/Microsoft.VisualStudio.SlnGen/ExtensionMethods.cs b/src/Microsoft.VisualStudio.SlnGen/ExtensionMethods.cs index e3fbe25..10521b1 100644 --- a/src/Microsoft.VisualStudio.SlnGen/ExtensionMethods.cs +++ b/src/Microsoft.VisualStudio.SlnGen/ExtensionMethods.cs @@ -117,6 +117,22 @@ public static bool IsPropertyValueTrue(this Project project, string name) return project.GetPropertyValue(name).Equals(bool.TrueString, StringComparison.OrdinalIgnoreCase); } + /// + /// Returns true if a property value exists else returns false. + /// + /// The < see cref="Project" /> to get the property of. + /// The name of the property. + /// if the property exists return true, otherwise false. + public static bool DoesPropertyExist(this Project project, string name) + { + if (project.GetPropertyValue(name).Equals(String.Empty)) + { + return false; + } + + return true; + } + /// /// Splits the current string as a semicolon delimited list of equals sign separated key/value pairs. /// diff --git a/src/Microsoft.VisualStudio.SlnGen/MSBuildPropertyNames.cs b/src/Microsoft.VisualStudio.SlnGen/MSBuildPropertyNames.cs index 13df898..a7dcde8 100644 --- a/src/Microsoft.VisualStudio.SlnGen/MSBuildPropertyNames.cs +++ b/src/Microsoft.VisualStudio.SlnGen/MSBuildPropertyNames.cs @@ -135,6 +135,11 @@ public static class MSBuildPropertyNames /// public const string UsingMicrosoftNETSdk = nameof(UsingMicrosoftNETSdk); + /// + /// Represents the NETCoreTargetsPath property. + /// + public const string NETCoreTargetsPath = nameof(NETCoreTargetsPath); + /// /// Represents the SlnGenIsBuildable property. /// diff --git a/src/Microsoft.VisualStudio.SlnGen/SlnProject.cs b/src/Microsoft.VisualStudio.SlnGen/SlnProject.cs index a13e439..bf6e996 100644 --- a/src/Microsoft.VisualStudio.SlnGen/SlnProject.cs +++ b/src/Microsoft.VisualStudio.SlnGen/SlnProject.cs @@ -35,6 +35,7 @@ public sealed class SlnProject [string.Empty] = DefaultLegacyProjectTypeGuid, [ProjectFileExtensions.CSharp] = DefaultLegacyProjectTypeGuid, [ProjectFileExtensions.VisualBasic] = new (VisualStudioProjectTypeGuids.LegacyVisualBasicProject), + [ProjectFileExtensions.SqlServerDb] = new (VisualStudioProjectTypeGuids.SqlServerDbProjectLegacy), }; /// @@ -45,6 +46,7 @@ public sealed class SlnProject [string.Empty] = DefaultNetSdkProjectTypeGuid, [ProjectFileExtensions.CSharp] = DefaultNetSdkProjectTypeGuid, [ProjectFileExtensions.VisualBasic] = new (VisualStudioProjectTypeGuids.NetSdkVisualBasicProject), + [ProjectFileExtensions.SqlServerDb] = new (VisualStudioProjectTypeGuids.SqlServerDbProjectSdk), }; /// @@ -63,7 +65,6 @@ public sealed class SlnProject [ProjectFileExtensions.NuProj] = new (VisualStudioProjectTypeGuids.NuProj), [ProjectFileExtensions.Scope] = new (VisualStudioProjectTypeGuids.ScopeProject), [ProjectFileExtensions.Shproj] = new (VisualStudioProjectTypeGuids.SharedProject), - [ProjectFileExtensions.SqlServerDb] = new (VisualStudioProjectTypeGuids.SqlServerDbProject), [ProjectFileExtensions.VcxItems] = new (VisualStudioProjectTypeGuids.Cpp), [ProjectFileExtensions.Wap] = new (VisualStudioProjectTypeGuids.WapProject), [ProjectFileExtensions.Wix] = new (VisualStudioProjectTypeGuids.Wix), @@ -160,6 +161,8 @@ public static SlnProject FromProject(Project project, IReadOnlyDictionary(), SolutionFolder = project.GetPropertyValueOrDefault(MSBuildPropertyNames.SlnGenSolutionFolder, string.Empty), IsBuildable = isBuildable, @@ -327,7 +330,7 @@ internal static Guid GetProjectGuid(Project project, bool isUsingMicrosoftNETSdk /// A value indicating whether or not the specified project is using Microsoft.NET.Sdk. /// An containing any user specified project type GUIDs to use. /// A representing the project type of the specified project. - internal static Guid GetProjectTypeGuid(string projectFileExtension, bool isUsingMicrosoftNETSdk, IReadOnlyDictionary customProjectTypeGuids) + internal static Guid GetProjectTypeGuid(string projectFileExtension, bool isUsingMicrosoftNETSdk, IReadOnlyDictionary customProjectTypeGuids, bool isUsingMicrosoftSQLSdk) { if (customProjectTypeGuids.TryGetValue(projectFileExtension, out Guid projectTypeGuid) || KnownProjectTypeGuids.TryGetValue(projectFileExtension, out projectTypeGuid)) { @@ -344,9 +347,17 @@ internal static Guid GetProjectTypeGuid(string projectFileExtension, bool isUsin return projectTypeGuid; } + if (isUsingMicrosoftSQLSdk) + { + if (KnownNetSdkProjectTypeGuids.TryGetValue(projectFileExtension, out projectTypeGuid)) + { + return projectTypeGuid; + } + } + if (!KnownLegacyProjectTypeGuids.TryGetValue(projectFileExtension, out projectTypeGuid)) { - projectTypeGuid = DefaultLegacyProjectTypeGuid; + return projectTypeGuid = DefaultLegacyProjectTypeGuid; } return projectTypeGuid; diff --git a/src/Microsoft.VisualStudio.SlnGen/VisualStudioProjectTypeGuids.cs b/src/Microsoft.VisualStudio.SlnGen/VisualStudioProjectTypeGuids.cs index 0d5d923..945db95 100644 --- a/src/Microsoft.VisualStudio.SlnGen/VisualStudioProjectTypeGuids.cs +++ b/src/Microsoft.VisualStudio.SlnGen/VisualStudioProjectTypeGuids.cs @@ -82,7 +82,12 @@ public static class VisualStudioProjectTypeGuids /// /// SQL Server database projects (.sqlproj). /// - public const string SqlServerDbProject = "00D1A9C2-B5F0-4AF3-8072-F6C62B433612"; + public const string SqlServerDbProjectLegacy = "00D1A9C2-B5F0-4AF3-8072-F6C62B433612"; + + /// + /// SQL Server database projects (.sqlproj). + /// + public const string SqlServerDbProjectSdk = "42EA0DBD-9CF1-443E-919E-BE9C484E4577"; /// /// Windows Application Packaging projects (.wapproj).