Adds the ability to customize the target SDK

This commit is contained in:
Zontreck 2023-09-24 07:59:37 -07:00
parent 3ee74ceb8f
commit 3f6d2e3cf3
2 changed files with 8 additions and 1 deletions

View file

@ -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
/// <value>The name.</value>
public string Name { get; internal set; } = "unknown";
/// <summary>
/// Project SDK
/// </summary>
public string SDK { get; internal set; } = "Microsoft.NET.Sdk";
/// <summary>
/// Contains settings for DotNet Maui (7.0+)
/// Default is null, which indicates not to include any Maui content in the project file.

View file

@ -734,7 +734,7 @@ public abstract class VSGenericTarget : ITarget
var postbuild = string.Empty;
using (ps)
{
ps.WriteLine("<Project Sdk=\"Microsoft.NET.Sdk\">");
ps.WriteLine($"<Project Sdk=\"{project.SDK}\">");
ps.WriteLine();
ps.WriteLine(" <PropertyGroup>");