Table of Contents

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

file string

Fields

file

Path to the project file.

public string file

Field Value

string

Properties

IsCore

Whether this is a .NET Core SDK-style project.

public bool IsCore { get; set; }

Property Value

bool

IsValidXml

Whether the project XML was loaded successfully.

public bool IsValidXml { get; }

Property Value

bool

Name

Gets the project name (filename without extension).

public string Name { get; }

Property Value

string

Methods

Delete(List<XmlElement>)

Deletes the specified XML elements from their parent nodes.

public void Delete(List<XmlElement> compile)

Parameters

compile List<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

element XmlNode

Parent XML node to search.

name string

Name of the child element to find.

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

file string

Path to the project file.

dictToAvoidCollectionWasChanged Dictionary<string, XmlDocument>

Optional dictionary cache to avoid collection-was-changed exceptions.

Returns

Task

ReturnAllItemGroup(ItemGroups)

Returns all XML nodes matching the specified item group type from the project.

public List<XmlNode> ReturnAllItemGroup(ItemGroups ig)

Parameters

ig ItemGroups

Item group type to search for (e.g. Compile, Reference).

Returns

List<XmlNode>

List of matching XML nodes.

Save()

Saves the XML document back to the project file.

public void Save()