Class VsProjectsFileHelper
- Namespace
- SunamoDevCode.Aps.Projs
- Assembly
- SunamoDevCode.dll
Use VsProjectFile,
public class VsProjectsFileHelper
- Inheritance
-
VsProjectsFileHelper
- Inherited Members
- Extension Methods
Fields
cacheProjectReferences
Cache of project references indexed by csproj path.
public static Dictionary<string, ProjectReferences> cacheProjectReferences
Field Value
Methods
AddFilesToCsproj(SolutionFolder, string, List<string>)
Adds missing files to a csproj as Compile items by comparing with already included files.
public static Task AddFilesToCsproj(SolutionFolder sln, string csprojpath, List<string> files)
Parameters
slnSolutionFolderSolution folder containing the project.
csprojpathstringPath to the csproj file.
filesList<string>List of absolute file paths to add.
Returns
AddItemGroupSdkStyle(string, ItemGroups, ItemGroupElement, bool)
Adds an ItemGroup element to an SDK-style .csproj file. Used in: MoveClassElementIntoSharedFileUC, AddFilesToCsproj. Works with pure XML classes, primarily for Compile tags.
public static Task AddItemGroupSdkStyle(string csprojPath, ItemGroups itemGroups, ItemGroupElement itemGroupElement, bool isWritingToStorage)
Parameters
csprojPathstringPath to the .csproj file.
itemGroupsItemGroupsThe type of ItemGroup to add (Compile, Reference, etc.).
itemGroupElementItemGroupElementThe ItemGroup element to add to the project.
isWritingToStorageboolWhether to write changes to storage immediately.
Returns
DuplicatedCsproj(ILogger, string)
Return paths of all csprojs
public static List<string> DuplicatedCsproj(ILogger logger, string path)
Parameters
loggerILoggerLogger instance for logging operations.
pathstringRoot path to search for csproj files.
Returns
GetProjectReferences(string, Dictionary<string, XmlDocument>, UriKind)
Gets project references from a csproj file. Works for .NET Core and Framework. Requires Microsoft.Build. For full dependency tree, use BuildProjectsDependencyTree.
public static Task<ProjectReferences> GetProjectReferences(string csprojPath, Dictionary<string, XmlDocument> dictToAvoidCollectionWasChanged, UriKind uriKind = UriKind.Absolute)
Parameters
csprojPathstringPath to the csproj file.
dictToAvoidCollectionWasChangedDictionary<string, XmlDocument>Dictionary cache for XML documents to avoid collection-changed exceptions.
uriKindUriKindWhether to return absolute or relative paths.
Returns
- Task<ProjectReferences>
Project references found in the csproj.
GetTokens(string)
Splits a relative path into tokens using detected delimiter (backslash, forward slash, or quotes).
public static List<string> GetTokens(string relativePath)
Parameters
relativePathstringRelative path to tokenize.
Returns
SetTargetFrameworksUap(string, string, string)
Sets the target frameworks for UAP (Universal Application Platform) projects. This method has been moved to SunamoMicrosoftBuild.
public static void SetTargetFrameworksUap(string csprojPath, string targetFramework, string minFramework)
Parameters
csprojPathstringPath to the .csproj file.
targetFrameworkstringThe target framework version.
minFrameworkstringThe minimum framework version.
Exceptions
- NotImplementedException
This method has been moved to another assembly.
XmlClassLibraryFromTemplate(string)
Vytvoří mi nový vsproj z templaty VS2019
public static Task<string> XmlClassLibraryFromTemplate(string safeProjectName)
Parameters
safeProjectNamestring