VSProject Interface

 

Contains the information specific to a Visual Basic or C# project. It is returned by the Object object when the project is a Visual Basic or Visual C# project.

Namespace:   VSLangProj
Assembly:  VSLangProj (in VSLangProj.dll)

[GuidAttribute("2CFB826F-F6BF-480D-A546-95A0381CC411")]
public interface VSProject

NameDescription
System_CAPS_pubpropertyBuildManager

Gets the BuildManager object of the VSProject. Read-only.

System_CAPS_pubpropertyDTE

Gets the top-level extensibility object.

System_CAPS_pubpropertyEvents

Gets a VSProjectEvents object that allows you to respond to events of the Imports, References, and BuildManager objects.

System_CAPS_pubpropertyImports

Gets the Imports object associated with the project. For C# projects, the Imports property is set to Nothing (a null reference). Read-only.

System_CAPS_pubpropertyProject

Gets the generic Project object associated with the Visual Basic or Visual C# project. Read-only.

System_CAPS_pubpropertyReferences

Gets the References collection for the project. Read-only.

System_CAPS_pubpropertyTemplatePath

Gets the full path of the directory that contains the project-item templates for Visual Basic or C#. Read-only.

System_CAPS_pubpropertyWebReferencesFolder

Gets the ProjectItem object representing the Web References folder of the project. If the folder does not exist, this property returns Nothing (a null reference). Read-only.

System_CAPS_pubpropertyWorkOffline

Gets or sets whether a Web project is working online or offline. When it is working offline, development continues on an offline store of project files, so that the project files on the server are not changed.

NameDescription
System_CAPS_pubmethodAddWebReference(String)

Adds a reference to a Web Service to the project. A new Web Service reference subfolder is added to the Web References folder of the project. This new folder contains several other project items related to the Web Service. The method returns the ProjectItem object associated with the new Web Service folder.

System_CAPS_pubmethodCopyProject(String, String, prjCopyProjectOption, String, String)

Copies some or all of a Web project to a new location.

System_CAPS_pubmethodCreateWebReferencesFolder()

Creates the Web References folder for the project.

System_CAPS_pubmethodExec(prjExecCommand, Int32, Object, Object)

This API supports the product infrastructure and is not intended to be used directly from your code. Microsoft Internal Use Only.

System_CAPS_pubmethodGenerateKeyPairFiles(String, String)

Generates a public/private key file used to form a strong name for the assembly.

System_CAPS_pubmethodGetUniqueFilename(Object, String, String)

Generates a unique file name within the project. Used for naming new project items.

System_CAPS_pubmethodRefresh()

Refreshes the appearance of the project in Solution Explorer, refreshes the references, and gets the latest compiled versions of the files.

Project is a core extensibility object that can contain information about projects of any language. The Object of the Project object returns an object whose type depends on the project language used. In the case of Visual Basic and Visual C#, that object is a VSProject object.

The Object returns an Object data type. The data object returned by the Object may then be explicitly converted to VSProject. The example below demonstrates this conversion using the CType function. The PrjKind is used to test for the project's type before the conversion.

[Visual Basic]

' Macro Editor
' This example retrieves the VSProject object if the first project
' the solution is a Visual Basic or C# project. This routine assumes
' that the solution contains at least one project.
Imports VSLangProj
Sub VSProjectExample()
   Dim aProject As Project
   Dim aVSProject As VSProject

   aProject = DTE.Solution.Projects.Item(1)
   If (aProject.Kind = PrjKind.prjKindVBProject) _
   Or (aProject.Kind = PrjKind.prjKindCSharpProject) Then
      aVSProject = CType(DTE.Solution.Projects.Item(1).Object, VSProject)
      MsgBox(aVSProject.Project.FullName)
   Else
      MsgBox("The first project is not a Visual Basic or C# project.")
   End If
End Sub
Return to top
Show: