Class VsProject
Data model that presents a visual studio project that has been loaded.
Inherited Members
Namespace: CodeFactory.VisualStudio
Assembly: CodeFactory.VisualStudio.dll
Syntax
public abstract class VsProject : VsModel, IVsProject, IVsModel, IModel<VisualStudioModelType>, IParent, IChildren
Constructors
| Improve this Doc View SourceVsProject(bool, bool, IReadOnlyList<ModelException<VisualStudioModelType>>, string, bool, bool, string, bool, IReadOnlyList<ProjectLanguage>, string, IReadOnlyList<VsProjectFramework>)
Constructor for the base class VsProject
Declaration
protected VsProject(bool isLoaded, bool hasErrors, IReadOnlyList<ModelException<VisualStudioModelType>> modelErrors, string name, bool hasParent, bool hasChildren, string path, bool legacyProjectModel, IReadOnlyList<ProjectLanguage> projectLanguages, string defaultNamespace, IReadOnlyList<VsProjectFramework> targetFrameworks)
Parameters
Type | Name | Description |
---|---|---|
bool | isLoaded | Flag that determines if the model is loaded. |
bool | hasErrors | Flag that determines if errors occurred while loading the model. |
IReadOnlyList<ModelException<VisualStudioModelType>> | modelErrors | The list of errors that occurred if any. |
string | name | The name of the model. |
bool | hasParent | Flag that determines if there is a parent model for this model. |
bool | hasChildren | Flag that determines if this model has child models. |
string | path | The fully qualified path of the project. |
bool | legacyProjectModel | Flag that determines if this project uses the legacy project system for visual studio. |
IReadOnlyList<ProjectLanguage> | projectLanguages | The programming languages this project supports. |
string | defaultNamespace | The default namespace for the project if it support .net framework or .net core. Otherwise this will be null. |
IReadOnlyList<VsProjectFramework> | targetFrameworks | List of the target frameworks this project sends output to on compile. |
Properties
| Improve this Doc View SourceDefaultNamespace
The default namespace for the project if it support .net framework or .net core. Otherwise this will be null.
Declaration
public string DefaultNamespace { get; }
Property Value
Type | Description |
---|---|
string |
HasChildren
Flag that determines if this visual studio object has child objects.
Declaration
public bool HasChildren { get; }
Property Value
Type | Description |
---|---|
bool |
HasParent
Flag that determines if the visual studio object has a parent.
Declaration
public bool HasParent { get; }
Property Value
Type | Description |
---|---|
bool |
LegacyProjectModel
Flag that determines if this visual studio project uses the legacy project model. If so then only basic capabilities and references will be available through code factory.
Declaration
public bool LegacyProjectModel { get; }
Property Value
Type | Description |
---|---|
bool |
Path
The fully qualified path to the project file name.
Declaration
public string Path { get; }
Property Value
Type | Description |
---|---|
string |
ProjectLanguages
The project languages that are supported in this project.
Declaration
public IReadOnlyList<ProjectLanguage> ProjectLanguages { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<ProjectLanguage> |
TargetFrameworks
Declaration
public IReadOnlyList<VsProjectFramework> TargetFrameworks { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<VsProjectFramework> |
Methods
| Improve this Doc View SourceAddDocumentAsync(string, string)
Adds a project document to the root of the project.
Declaration
public abstract Task<VsDocument> AddDocumentAsync(string fileName, string content = null)
Parameters
Type | Name | Description |
---|---|---|
string | fileName | The file name of the document. This should be the name only with no file path. |
string | content | The content that will be initially added to the document. This is an optional parameter. |
Returns
Type | Description |
---|---|
Task<VsDocument> | The created project document. |
AddExistingDocumentAsync(string)
Adds an existing document to the project.
Declaration
public abstract Task<VsDocument> AddExistingDocumentAsync(string fileName)
Parameters
Type | Name | Description |
---|---|---|
string | fileName | The file name for the document. This should be the file name only with extension. The file must already be in the projects folder. |
Returns
Type | Description |
---|---|
Task<VsDocument> | The model of the created project document. |
AddProjectFolderAsync(string)
Adds a project folder to the root of the project.
Declaration
public abstract Task<VsProjectFolder> AddProjectFolderAsync(string folderName)
Parameters
Type | Name | Description |
---|---|---|
string | folderName | The name of the project folder. This should be the name only with no path. |
Returns
Type | Description |
---|---|
Task<VsProjectFolder> | The created project folder. |
GetChildrenAsync(bool, bool)
Get all the children that are direct children of the project.
Declaration
public abstract Task<IReadOnlyList<VsModel>> GetChildrenAsync(bool allChildren, bool loadSourceCode = false)
Parameters
Type | Name | Description |
---|---|---|
bool | allChildren | Flag that determines if it should return all children of the project and not just the top level children. |
bool | loadSourceCode | Flag to determine if code files that support code factory source code will be loaded by default. If enabled this could be memory intensive. |
Returns
Type | Description |
---|---|
Task<IReadOnlyList<VsModel>> | The children of the project, if no children are found and empty enumeration will be returned. |
GetParentAsync()
Gets the parent solution folder that holds the project.
Declaration
public abstract Task<VsSolutionFolder> GetParentAsync()
Returns
Type | Description |
---|---|
Task<VsSolutionFolder> | Returns a solution folder if the project has a parent or null if the project has no parent. |
GetProjectReferencesAsync()
Gets the references assigned to this project.
Declaration
public abstract Task<IReadOnlyList<VsReference>> GetProjectReferencesAsync()
Returns
Type | Description |
---|---|
Task<IReadOnlyList<VsReference>> | Readonly list of the references. |
GetReferencedProjects()
Get the VsProject models for all projects that are referenced by this project.
Declaration
public Task<IReadOnlyList<VsProject>> GetReferencedProjects()
Returns
Type | Description |
---|---|
Task<IReadOnlyList<VsProject>> | Readonly list of the referenced projects or an empty list if there is no referenced projects. |