Model the target framework value found in a C# project file.

Project File Parts

ProjectFileParts.cs
using System;

class Program
{
    static void Main()
    {
        string targetFramework = ;
        bool currentLts = targetFramework == "net8.0";
        string projectType = targetFramework.StartsWith("net") ? "sdk-style" : "legacy";

        Console.WriteLine($"targetFramework={targetFramework}");
        Console.WriteLine($"projectType={projectType}");
        Console.WriteLine($"currentLts={currentLts}");
    }
}
using System;

class Program
{
    static void Main()
    {
        string targetFramework = ;
        bool currentLts = targetFramework == "net8.0";
        string projectType = targetFramework.StartsWith("net") ? "sdk-style" : "legacy";

        Console.WriteLine($"targetFramework={targetFramework}");
        Console.WriteLine($"projectType={projectType}");
        Console.WriteLine($"currentLts={currentLts}");
    }
}
using System;

class Program
{
    static void Main()
    {
        string targetFramework = ;
        bool currentLts = targetFramework == "net8.0";
        string projectType = targetFramework.StartsWith("net") ? "sdk-style" : "legacy";

        Console.WriteLine($"targetFramework={targetFramework}");
        Console.WriteLine($"projectType={projectType}");
        Console.WriteLine($"currentLts={currentLts}");
    }
}
tooling A `.csproj` file stores project metadata such as the target framework, which guides the build tool.