Show / Hide Table of Contents

Class ProjectExtensions

Extension methods for the Project class.

Inheritance
System.Object
ProjectExtensions
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EnvDTE
Assembly: Community.VisualStudio.Toolkit.dll
Syntax
public static class ProjectExtensions

Methods

| Improve this Doc View Source

AddFilesToProjectAsync(Project, String[])

Adds one or more files to the project.

Declaration
public static Task AddFilesToProjectAsync(this Project project, params string[] files)
Parameters
Type Name Description
EnvDTE.Project project
System.String[] files
Returns
Type Description
System.Threading.Tasks.Task
| Improve this Doc View Source

AsSolutionFolder(Project)

Casts the Project to a SolutionFolder.

Declaration
public static SolutionFolder AsSolutionFolder(this Project project)
Parameters
Type Name Description
EnvDTE.Project project
Returns
Type Description
EnvDTE80.SolutionFolder
| Improve this Doc View Source

Build(Project, Boolean)

Kicks off a build of the project.

Declaration
public static vsBuildState Build(this Project project, bool waitForBuildToFinish = false)
Parameters
Type Name Description
EnvDTE.Project project
System.Boolean waitForBuildToFinish
Returns
Type Description
EnvDTE.vsBuildState
| Improve this Doc View Source

GetDirectory(Project)

Gets the root folder of any Visual Studio project.

Declaration
public static string GetDirectory(this Project project)
Parameters
Type Name Description
EnvDTE.Project project
Returns
Type Description
System.String
| Improve this Doc View Source

GetProjectNamespace(Project)

Gets the default namespace or asembly name of the project.

Declaration
public static string GetProjectNamespace(this Project project)
Parameters
Type Name Description
EnvDTE.Project project
Returns
Type Description
System.String
Remarks

It tries to get the DefaultNamespace first, and will then fallback to RootNamespace and then AssemblyName. The different project types in Visual Studio differ in how they support similar concepts, so the code tries different properties to compensate.

| Improve this Doc View Source

IsKind(Project, String[])

Check what kind the project is.

Declaration
public static bool IsKind(this Project project, params string[] kindGuids)
Parameters
Type Name Description
EnvDTE.Project project

The project to check.

System.String[] kindGuids

Use the ProjectTypes list of strings

Returns
Type Description
System.Boolean
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX