Sdílet prostřednictvím


VSProject.WebReferencesFolder Property

Definition

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.

public:
 property EnvDTE::ProjectItem ^ WebReferencesFolder { EnvDTE::ProjectItem ^ get(); };
public:
 property EnvDTE::ProjectItem ^ WebReferencesFolder { EnvDTE::ProjectItem ^ get(); };
[System.Runtime.InteropServices.DispId(6)]
public EnvDTE.ProjectItem WebReferencesFolder { [System.Runtime.InteropServices.DispId(6)] get; }
[<System.Runtime.InteropServices.DispId(6)>]
[<get: System.Runtime.InteropServices.DispId(6)>]
member this.WebReferencesFolder : EnvDTE.ProjectItem
Public ReadOnly Property WebReferencesFolder As ProjectItem

Property Value

Returns a ProjectItem object representing the Web References folder.

Attributes

Examples

[Visual Basic]

' Macro Editor  
' This example creates a Web references folder, if it does not   
' already exist, and displays some of the folder properties.  
Imports VSLangProj  
Sub WebReferencesFolderExample()  
   ' This example assumes that the first project in the   
   ' solution is either a Visual Basic or C# project.  
   Dim aVSProject As VSProject = _  
      CType(DTE.Solution.Projects.Item(1).Object, VSProject)  

   ' Add a new folder if it does not already exist.  
   If (aVSProject.WebReferencesFolder Is Nothing) Then  
      Dim newFolder As ProjectItem  
      newFolder = aVSProject.CreateWebReferencesFolder()  
   End If  

   ' Display the name of the Web references folder.  
   Dim theFolder As ProjectItem = aVSProject.WebReferencesFolder  
   MsgBox("The name of the WebReferences folder is " _  
      & theFolder.Name & ".")  

   ' All Visual Basic and C# Web references folders are physical.  
   If (theFolder.Kind = _  
      EnvDTE.Constants.vsProjectItemKindPhysicalFolder) Then  
      MsgBox(theFolder.Name & " is a physical folder.")  
   End If  

   MsgBox("There are " & theFolder.ProjectItems.Count.ToString() & _  
      " Web references.")  
End Sub  

Remarks

A project's Web references may be retrieved by accessing the ProjectItems property of the WebReferencesFolder.

A project contains at most one Web References folder. The folder may be created using the CreateWebReferencesFolder. In addition, the folder is created automatically when the first Web reference is added to the project using the CreateWebReferencesFolder.

In a Visual Basic or C# project, the Kind property of the WebReferencesFolder project item is always vsProjectItemKindPhysicalFolder, because Visual Basic and C# projects support only physical files.

Applies to