Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

Properties Property (Visual Basic and C# ProjectItem Object)

Visual Studio .NET 2003

Provides specific details about the current folder or file. The properties contained in the Properties property of the ProjectItem object depend on the language of the project and the type of project item. The properties for Visual Basic and C# projects are described below.

These properties apply to ProjectItem objects that are files.

PropertyDescription
FileName PropertyReturns the file name and extension of the file or folder represented by the ProjectItem.
FullPath PropertyReturns the path to the project folder where the file resides. Returns an empty string for projects accessed through FrontPage Server Extensions.
LocalPath PropertyWeb projects: Returns the path to the Web cache folder where the file resides.

Local projects: Returns the local project path (same as the FullPath property).

URL PropertyWeb projects: Returns the URL to the project folder.

Local projects: returns the local project path in file:///projectpath format.

Extension PropertyReturns the extension of the file.
FileSize PropertyReturns the size of the file in KB.
DateCreated PropertyReturns the date and time when the file was created.
DateModified PropertyReturns the date and time the file was last modified.
SubType PropertyReturns or sets the SubType of the file.
BuildAction PropertyReturns or sets the build action to perform with the file.
CustomTool PropertyReturns or sets the program identifier of the custom tool associated with the file.
CustomToolNamespace PropertyReturns or sets the default namespace for the generated files.
HTMLTitle PropertyReturns the title of an HTML page for projects accessed through FrontPage Server Extensions. Otherwise, returns an empty string.
Author PropertyReturns the name of the user who created the file for projects accessed through FrontPage Server Extensions. Otherwise, returns an empty string.
ModifiedBy PropertyReturns the name of the user who last modified the file for projects accessed through FrontPage Server Extensions. Otherwise, returns an empty string. Read-only.
CustomToolOutput PropertyReturns the file name, without the path, of the output of the custom tool associated with the project item.
IsCustomToolOutput PropertyIndicates whether the ProjectItem is the output of a custom tool.
IsDependentFile PropertyIndicates whether the ProjectItem is a dependent file.
IsLink PropertyIndicates whether the file is located under the local project directory.
IsDesignTimeBuildInput PropertyIndicates whether a file is a design-time build input file.

These properties apply to ProjectItem objects that are folders.

PropertyDescription
FileName PropertyReturns the name of the folder.
FullPath PropertyReturns the path to the project folder. Returns an empty string for projects accessed through FrontPage Server Extensions.
LocalPath PropertyWeb projects: Returns the path to the Web cache folder.

Local projects: Returns an empty string.

URL PropertyWeb projects: Returns the URL to project folder.

Local projects: Returns an empty string.

UrlBehavior PropertyDetermines whether the URL of a Web reference is hard-coded into the generated Visual Basic or Visual C# proxy code.
WebReference PropertyIf the ProjectItem is a Web reference, returns the URL to the XML Web service's .wsdl (Web Services Description Language) file.
DefaultNamespace PropertySpecifies the default namespace of the folder.

Example

This example displays a list of all the properties, their values, and their types.

' Macro Editor
Sub ListProperties()
   Dim projectItem As EnvDTE.ProjectItem
   Dim prop As EnvDTE.Property
   Dim propList As String
        
   For Each projectItem In DTE.Solution.Projects.Item(1).ProjectItems
      propList = ""
      If Not IsNothing(projectItem.Properties) Then
         For Each prop In projectItem.Properties
            propList &= prop.Name & ": " & prop.Value.ToString & _
               " (" & prop.Value.GetType.ToString & ")" & _
               ControlChars.CrLf
         Next
         MsgBox(propList)
      End If
   Next
End Sub

The following example demonstrates changing the value of the SubType property. To retrieve and set a particular property, use the property name as an index into the Item method, which returns a Property object. Then set the Value property.

Sub SetSubType(ByVal newType As String, ByVal projItem As ProjectItem)
   projItem.Properties.Item("SubType").Value = newType
End Sub

See Also

Properties Property (General Extensibility)

Applies To: ProjectItem Object

Show:
© 2015 Microsoft