VSProject Interface
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.
public interface class VSProject
public interface class VSProject
__interface VSProject
[System.Runtime.InteropServices.Guid("2CFB826F-F6BF-480D-A546-95A0381CC411")]
[System.Runtime.InteropServices.TypeLibType(4160)]
public interface VSProject
[System.Runtime.InteropServices.Guid("2CFB826F-F6BF-480D-A546-95A0381CC411")]
public interface VSProject
[<System.Runtime.InteropServices.Guid("2CFB826F-F6BF-480D-A546-95A0381CC411")>]
[<System.Runtime.InteropServices.TypeLibType(4160)>]
type VSProject = interface
[<System.Runtime.InteropServices.Guid("2CFB826F-F6BF-480D-A546-95A0381CC411")>]
type VSProject = interface
Public Interface VSProject
- Derived
- Attributes
Examples
[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
Remarks
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.
Properties
BuildManager |
Gets the BuildManager object of the VSProject. Read-only. |
DTE |
Gets the top-level extensibility object. |
Events |
Gets a VSProjectEvents object that allows you to respond to events of the Imports, References, and BuildManager objects. |
Imports |
Gets the Imports object associated with the project. For C# projects, the Imports property is set to Nothing (a null reference). Read-only. |
Project |
Gets the generic Project object associated with the Visual Basic or Visual C# project. Read-only. |
References |
Gets the References collection for the project. Read-only. |
TemplatePath |
Gets the full path of the directory that contains the project-item templates for Visual Basic or C#. Read-only. |
WebReferencesFolder |
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. |
WorkOffline |
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. |
Methods
AddWebReference(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. |
CopyProject(String, String, prjCopyProjectOption, String, String) |
Copies some or all of a Web project to a new location. |
CreateWebReferencesFolder() |
Creates the Web References folder for the project. |
Exec(prjExecCommand, Int32, Object, Object) |
Microsoft Internal Use Only. |
GenerateKeyPairFiles(String, String) |
Generates a public/private key file used to form a strong name for the assembly. |
GetUniqueFilename(Object, String, String) |
Generates a unique file name within the project. Used for naming new project items. |
Refresh() |
Refreshes the appearance of the project in Solution Explorer, refreshes the references, and gets the latest compiled versions of the files. |