Class CsprojHelper
- Namespace
- SunamoCsproj
- Assembly
- SunamoCsproj.dll
Helper methods for working with csproj files.
public class CsprojHelper : CsprojConsts
- Inheritance
-
CsprojHelper
- Inherited Members
- Extension Methods
Fields
ClassCodeElements
Keywords that indicate class-level code elements.
public static readonly List<string> ClassCodeElements
Field Value
Methods
AddLinkToCsproj(string, string, string)
[Obsolete("everything from here will be converted to CsprojInstance. Don't add a single method here!")]
public static Task AddLinkToCsproj(string target, string source, string csprojPath)
Parameters
Returns
CsprojPathFromName(string, string)
[Obsolete("everything from here will be converted to CsprojInstance. Don't add a single method here!")]
public static string CsprojPathFromName(string slnFolder, string fileNameWithoutExtension)
Parameters
Returns
DetectDuplicatedProjectAndPackageReferences(List<string>)
EN: Must be here, works with multiple csproj files at once. CZ: Musí být zde, pracuje s více csproj najednou.
public static Task<string> DetectDuplicatedProjectAndPackageReferences(List<string> csprojs)
Parameters
Returns
GetCsprojFromCsPath(string, string?)
EN: Returns path to csproj file, not folder. CZ: Vrací cestu k csproj souboru, nikoliv složce.
[Obsolete("everything from here will be converted to CsprojInstance. Don't add a single method here!")]
public static string GetCsprojFromCsPath(string path, string? slnFolder = null)
Parameters
pathstringEN: Path to .cs file. CZ: Cesta k .cs souboru.
slnFolderstringEN: Solution folder or null. CZ: Složka solution nebo null.
Returns
- string
EN: Path to csproj file. CZ: Cesta k csproj souboru.
ParseCsproj(string)
Use RHSE2.SetPropertyToInnerClass
[Obsolete("everything from here will be converted to CsprojInstance. Don't add a single method here!")]
public static Task ParseCsproj(string contentOrPath)
Parameters
contentOrPathstring
Returns
ParseNamespaceFromCsFile(string, string?)
EN: Parses namespace from .cs file. Item1 is project name, Item2 is sanitized full namespace. CZ: Parsuje jmenný prostor z .cs souboru. Item1 je název projektu, Item2 je sanitizované celé NS.
[Obsolete("everything from here will be converted to CsprojInstance. Don't add a single method here!")]
public static (string, string) ParseNamespaceFromCsFile(string content, string? path)
Parameters
contentstringEN: File content. CZ: Obsah souboru.
pathstringEN: File path or null. CZ: Cesta k souboru nebo null.
Returns
- (string, string)
EN: Tuple (project name, full sanitized namespace). CZ: Tuple (název projektu, celé sanitizované NS).
RemoveDuplicatedProjectAndPackageReferences(List<string>)
public static Task RemoveDuplicatedProjectAndPackageReferences(List<string> list)
Parameters
Returns
ReplaceProjectReferenceForPackageReference(string, List<string>, bool)
[Obsolete("everything from here will be converted to CsprojInstance. Don't add a single method here!")]
public static Task<string> ReplaceProjectReferenceForPackageReference(string pathOrContentCsproj, List<string> availableNugetPackages, bool isTests)
Parameters
Returns
ReplaceProjectReferenceForPackageReferenceWithRemoved(string, List<string>, bool)
EN: Replaces ProjectReference with PackageReference and returns new csproj content + names of replaced projects. CZ: Nahradí ProjectReference za PackageReference a vrátí nový obsah csproj + názvy projektů, které byly nahrazeny.
public static Task<(string, List<string>)> ReplaceProjectReferenceForPackageReferenceWithRemoved(string contentCsproj, List<string> availableNugetPackagesS, bool isTests)
Parameters
contentCsprojstringEN: Content of csproj file. CZ: Obsah csproj souboru.
availableNugetPackagesSList<string>EN: List of available NuGet packages. CZ: Seznam dostupných NuGet balíčků.
isTestsboolEN: Whether this is a test project. CZ: Zda je to testovací projekt.