Classes¶
vsgen provides a collection of Python classes that represent solutions, projects, and other concepts used by Visual Studio to organise resources.
See also
Microsoft’s Solutions and Projects in Visual Studio
Interfaces¶
Each vsgen object executes one or more actions and vsgen uses a small collection of interface to define these actions.
The Writable Interface¶
The VSGWritable is a base class for all objects that writes to the disk.
The Registerable Interface¶
The VSGRegisterable is the base class for all objects that registers data with operating system.
Commands¶
For efficiency and convenience vsgen provides command objects that adapt each interface object into an vsgen’s execution model.
The Write Command¶
The VSGWriteCommand is the command object that executes any VSGWritable implementing object.
The Register Command¶
The VSGRegisterCommand is the command object that executes any VSGRegisterable implementing object.
Utility Mixins¶
For efficiency and convenience vsgen provides utility mixin that define object extensions extend that are optional in an vsgen’s execution model.
JinjaRenderer¶
The VSGJinjaRenderer is a mixin defining methods to render files with Jinja2.
Solutions¶
Visual Studio currently uses one solution type so vsgen currently provides a single solution, the VSGSolution class.
The VSGSolution is designed to represent a single .sln solution file; it contains basic attributes (Name and FileName) and a collection of Projects that contains a number of VSGProject dervied classes.
The solution class implements the VSGWritable interface and uses a VSGJinjaRenderer to write the .sln file from an internal template vsgen\data\sln.jinja
Projects¶
Visual Studio handles different project types so vsgen currently provides a base project class VSGProject for other classes to inherit and specialize.
Since it is a base class, it contains only basic attributes such as Name, FileName, etc. Plugins will inherit from VSGProject and extended it with additional attributes and methods needed to define their respective Visual Studio projects.
Suites¶
Suites are user defined groupings of solutions and projects. These groups are repsent the pre-set configuration and are invoked by the auto command. VSGen provides a base VSGSuite for other classes to inherit and extend.
Example¶
The vsgen test suite contains an working example of using the objects in a demo package: