Class VsProjectFile
- Namespace
- SunamoDevCode.Aps.Projs
- Assembly
- SunamoDevCode.dll
In case when ProjectCollection wont work (like actually dont return any Compile elements)
public class VsProjectFile
- Inheritance
-
VsProjectFile
- Inherited Members
- Extension Methods
Constructors
VsProjectFile()
Default constructor for VsProjectFile.
public VsProjectFile()
VsProjectFile(string)
Before calling must check whether file is exists
public VsProjectFile(string file)
Parameters
filestring
Fields
file
Path to the project file.
public string file
Field Value
Properties
IsCore
Whether this is a .NET Core SDK-style project.
public bool IsCore { get; set; }
Property Value
IsValidXml
Whether the project XML was loaded successfully.
public bool IsValidXml { get; }
Property Value
Name
Gets the project name (filename without extension).
public string Name { get; }
Property Value
Methods
Delete(List<XmlElement>)
Deletes the specified XML elements from their parent nodes.
public void Delete(List<XmlElement> compile)
Parameters
compileList<XmlElement>List of XML elements to remove.
GetElementOfName(XmlNode, string)
Gets the first child element with the specified name from an XML node.
public static XmlNode GetElementOfName(XmlNode element, string name)
Parameters
Returns
- XmlNode
First matching child node.
Load(string, Dictionary<string, XmlDocument>?)
Loads the XML document for the project file, using a cache dictionary if provided.
public Task Load(string file, Dictionary<string, XmlDocument>? dictToAvoidCollectionWasChanged)
Parameters
filestringPath to the project file.
dictToAvoidCollectionWasChangedDictionary<string, XmlDocument>Optional dictionary cache to avoid collection-was-changed exceptions.
Returns
ReturnAllItemGroup(ItemGroups)
Returns all XML nodes matching the specified item group type from the project.
public List<XmlNode> ReturnAllItemGroup(ItemGroups ig)
Parameters
igItemGroupsItem group type to search for (e.g. Compile, Reference).
Returns
Save()
Saves the XML document back to the project file.
public void Save()