dotnet-solution
A model, reader and writer to manage Visual Studio Solution Files (*.sln
)
Installation
npm install --save dotnet-solution
Usage
// create a reader, and build a solution from the linesconst reader = const sourceLines = fsconst solution = reader solution // create a writer and write back to the same fileconst writer = const lines = writerfs
Methods
SolutionReader
-
Solution fromLines(lines[])
Parses a solution file's lines into a
Solution
object.const sourceLines = fsconst solution = reader
SolutionWriter
-
lines[] write(Solution)
Writes a
Solution
out as an array of lines.const lines = writerfs
Solution
-
object[] getFolders()
Returns an array of folders in the solution.
const folders = solution/*[{id: '93E2EDB0-2AB9-4A5E-A8BD-658CAD43C2B7',name: 'Parent',path: 'Parent'},{id: 'E2939C1D-DE3E-4455-88D6-CBA711FE1FAD',name: 'ChildOne',path: 'ChildOne',parent: 'Parent'}]*/ -
object[] getProjects()
Returns an array of projects in the solution.
const projects = solution/*[{id: '7EC623E8-DE59-4A2C-AD1F-333F2E54AECA',name: 'ProjectUnderParent',path: 'ProjectUnderParent\\ProjectUnderParent.csproj',parent: 'Parent'}]*/ -
void addFolder({ id, name, path, parent })
Adds a folder to the solution.
parent
is optional, and can either be theid
or thename
of another folder in the solution.solution -
void addProject({ id, name, path, parent })
Adds a project to the solution.
parent
is optional, and can either be theid
or thename
of a folder in the solution.solution