Table of Contents

Class SunamoCsprojHelper

Namespace
SunamoDevCode.Aps.Projs
Assembly
SunamoDevCode.dll

Provides helper methods for analyzing and manipulating .csproj files.

public class SunamoCsprojHelper
Inheritance
SunamoCsprojHelper
Inherited Members
Extension Methods

Fields

type

Type information for the SunamoCsprojHelper class.

public static Type type

Field Value

Type

Methods

AddMissingProjects(SolutionFolder, bool)

Adds missing projects to a solution.

public static Task AddMissingProjects(SolutionFolder solutionFolder, bool isAddingDependencies = false)

Parameters

solutionFolder SolutionFolder

The solution folder to add projects to.

isAddingDependencies bool

Whether to also add project dependencies.

Returns

Task

AddMissingProjectsAlsoString(object, bool)

Must be async

public static Task<object> AddMissingProjectsAlsoString(object text, bool addAlsoDepedencies = false)

Parameters

text object

Solution path or SolutionFolder object

addAlsoDepedencies bool

Whether to add also dependencies

Returns

Task<object>

BuildProjectsDependencyTreeList(string, Dictionary<string, XmlDocument>)

Builds a list of project dependency tree paths for the given .csproj file.

public static Task<List<string>> BuildProjectsDependencyTreeList(string csprojPath, Dictionary<string, XmlDocument> dictToAvoidCollectionWasChanged)

Parameters

csprojPath string

Path to the .csproj file to analyze.

dictToAvoidCollectionWasChanged Dictionary<string, XmlDocument>

Dictionary to avoid collection modification during iteration.

Returns

Task<List<string>>

List of project dependency paths.

DetectNetVersion(string)

Whether is old .net fw, version

public static Task<Tuple<bool, string>> DetectNetVersion(string path)

Parameters

path string

Path to the csproj file.

Returns

Task<Tuple<bool, string>>

Tuple of (isNewSdkStyle, versionString), or null if XML is invalid.

DetectNetVersion2(string)

Detects the .NET framework version and returns it as a SupportedNetFw enum value.

public static Task<SupportedNetFw> DetectNetVersion2(string path)

Parameters

path string

Path to the csproj file.

Returns

Task<SupportedNetFw>

The detected .NET framework enum value.

IsProjectCsprojSdkStyleIsCore(string)

Checks whether a csproj is SDK-style and also determines if it targets netstandard.

public static Task<IsProjectCsprojSdkStyleResult?> IsProjectCsprojSdkStyleIsCore(string fileOrContent)

Parameters

fileOrContent string

File path or content string of the csproj.

Returns

Task<IsProjectCsprojSdkStyleResult>

Result containing the content, SDK-style status, and netstandard status, or null for invalid XML.