Table of Contents

Class ChangeProjects

Namespace
SunamoDevCode.ToNetCore.research
Assembly
SunamoDevCode.dll

Provides methods for changing target framework monikers in .csproj project files.

public class ChangeProjects
Inheritance
ChangeProjects
Inherited Members
Extension Methods

Fields

end

Closing XML tag for TargetFramework element in csproj files.

public const string end = "</TargetFramework>"

Field Value

string

net472

Target framework moniker for .NET Framework 4.7.2.

public const string net472 = "net472"

Field Value

string

net48

Target framework moniker for .NET Framework 4.8.

public const string net48 = "net48"

Field Value

string

net5Uap

Target framework moniker for .NET 5.0 UWP/UAP Windows platform.

public const string net5Uap = "net5.0-windows10.0.19041.0"

Field Value

string

net60

Target framework moniker for .NET 6.0.

public const string net60 = "net6.0"

Field Value

string

net70Windows

Na mém PC bude mít vše net7.0-windows Bylo by to velmi náročné dělat průběžné změny mezi net7.0 argument net7.0-windows

public const string net70Windows = "net7.0-windows"

Field Value

string

net7Windows

Target framework moniker for .NET 7.0 Windows platform.

public const string net7Windows = "net7.0-windows"

Field Value

string

netcoreapp

Target framework moniker for .NET Core App 1.1.

public const string netcoreapp = "netcoreapp1.1"

Field Value

string

netstandard20

Target framework moniker for .NET Standard 2.0.

public const string netstandard20 = "netstandard2.0"

Field Value

string

netstandard21

Target framework moniker for .NET Standard 2.1.

public const string netstandard21 = "netstandard2.1"

Field Value

string

start

Opening XML tag for TargetFramework element in csproj files.

public const string start = "<TargetFramework>"

Field Value

string

Methods

ChangeProjectTo(string, string, IsNetCore5UpMonikerResult?, string?)

Replace only between TargetFramework

public static Task ChangeProjectTo(string to2, string path, IsNetCore5UpMonikerResult? parsedMonikerTo, string? dontChangeIfSourceIs = null)

Parameters

to2 string

Target framework moniker to change to.

path string

Path to the csproj file.

parsedMonikerTo IsNetCore5UpMonikerResult

Parsed target moniker result.

dontChangeIfSourceIs string

If the current framework matches this value, skip the change.

Returns

Task

ChangeProjectsTo(string, List<TWithStringDC<string>>)

Changes target framework in all project files from the list to the specified framework moniker.

public static Task ChangeProjectsTo(string to2, List<TWithStringDC<string>> l)

Parameters

to2 string

Target framework moniker to change to.

l List<TWithStringDC<string>>

List of project items containing content and path.

Returns

Task

ChangeProjectsTo(string, List<string>)

Changes target framework in all project files at the specified paths to the given framework moniker.

public static Task ChangeProjectsTo(string to2, List<string> vs)

Parameters

to2 string

Target framework moniker to change to.

vs List<string>

List of csproj file paths to update.

Returns

Task

IsNetCore5UpMoniker(string)

Parses a target framework moniker to determine if it is a .NET 5+ style moniker (e.g., net5.0, net7.0-windows).

public static IsNetCore5UpMonikerResult? IsNetCore5UpMoniker(string moniker)

Parameters

moniker string

Target framework moniker string to parse.

Returns

IsNetCore5UpMonikerResult

Parsed result with framework version and platform TFM, or null if not a .NET 5+ moniker.

Test()

Tests the IsNetCore5UpMoniker method with various target framework monikers.

public static void Test()