FileNode.SetEditLabel Method (String, String)

Renames the file with the given name and relative path.

Namespace:  Microsoft.VisualStudio.Package
Assembly:  MPF.Project.NonShipping (in MPF.Project.NonShipping.dll)

Syntax

'宣言
Protected Friend Overrides Function SetEditLabel ( _
    label As String, _
    strRelPath As String _
) As Integer
'使用
Dim label As String
Dim strRelPath As String
Dim returnValue As Integer

returnValue = Me.SetEditLabel(label, _
    strRelPath)
protected internal override int SetEditLabel(
    string label,
    string strRelPath
)
protected public:
virtual int SetEditLabel(
    String^ label, 
    String^ strRelPath
) override
protected internal override function SetEditLabel(
    label : String, 
    strRelPath : String
) : int

Parameters

  • strRelPath
    Type: System.String

     The relative path of the file.

Return Value

Type: System.Int32

Returns S_FALSE if the new file name is the same as the old one, or if the file's ID has changed. Returns the corresponding HRESULT for any exception that has occurred.

Exceptions

Exception Condition
[System.InvalidOperationException]

The file already exists.

Remarks

This method checks whether a file of the same name exists on disk; if not, it constructs the path of the file, updates the build item's metadata, and calls [RenameDocument(string oldName, string newName)]. If the file does not get renamed (for example, because it was opened by another project), the metadata changes are backed out.

Permissions

See Also

Reference

FileNode Class

FileNode Members

SetEditLabel Overload

Microsoft.VisualStudio.Package Namespace