From 3f6d2e3cf3b9690246ab490664632e2fe95d3f2b Mon Sep 17 00:00:00 2001 From: Zontreck Date: Sun, 24 Sep 2023 07:59:37 -0700 Subject: [PATCH] Adds the ability to customize the target SDK --- source/Prebuild/Core/Nodes/ProjectNode.cs | 7 +++++++ source/Prebuild/Core/Targets/VSGenericTarget.cs | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/source/Prebuild/Core/Nodes/ProjectNode.cs b/source/Prebuild/Core/Nodes/ProjectNode.cs index 23090d2..c1ba0f4 100644 --- a/source/Prebuild/Core/Nodes/ProjectNode.cs +++ b/source/Prebuild/Core/Nodes/ProjectNode.cs @@ -178,6 +178,7 @@ public class ProjectNode : DataNode, IComparable public override void Parse(XmlNode node) { Name = Helper.AttributeValue(node, "name", Name); + SDK = Helper.AttributeValue(node, "sdk", SDK); Path = Helper.AttributeValue(node, "path", Path); FilterGroups = Helper.AttributeValue(node, "filterGroups", FilterGroups); Version = Helper.AttributeValue(node, "version", Version); @@ -266,6 +267,7 @@ public class ProjectNode : DataNode, IComparable XmlElement proj = doc.CreateElement("Project"); proj.SetAttribute("name", Name); + proj.SetAttribute("sdk", SDK); proj.SetAttribute("path", Path); proj.SetAttribute("filterGroups", FilterGroups); proj.SetAttribute("version", Version); @@ -384,6 +386,11 @@ public class ProjectNode : DataNode, IComparable /// The name. public string Name { get; internal set; } = "unknown"; + /// + /// Project SDK + /// + public string SDK { get; internal set; } = "Microsoft.NET.Sdk"; + /// /// Contains settings for DotNet Maui (7.0+) /// Default is null, which indicates not to include any Maui content in the project file. diff --git a/source/Prebuild/Core/Targets/VSGenericTarget.cs b/source/Prebuild/Core/Targets/VSGenericTarget.cs index a061264..a689985 100644 --- a/source/Prebuild/Core/Targets/VSGenericTarget.cs +++ b/source/Prebuild/Core/Targets/VSGenericTarget.cs @@ -734,7 +734,7 @@ public abstract class VSGenericTarget : ITarget var postbuild = string.Empty; using (ps) { - ps.WriteLine(""); + ps.WriteLine($""); ps.WriteLine(); ps.WriteLine(" ");