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
label
Type: System.StringThe name of the file.
strRelPath
Type: System.StringThe 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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.