Compartir a través de


VSProjectItem.RunCustomTool Method

Definition

Runs the custom tool associated with a ProjectItem object. A custom tool is a registered component that implements the IVsSingleFileGenerator interface. Custom tools are similar to designers and editors.

public:
 void RunCustomTool();
public:
 void RunCustomTool();
void RunCustomTool();
[System.Runtime.InteropServices.DispId(4)]
public void RunCustomTool ();
[<System.Runtime.InteropServices.DispId(4)>]
abstract member RunCustomTool : unit -> unit
Public Sub RunCustomTool ()
Attributes

Remarks

A custom tool takes as input the file represented by a ProjectItem and writes a new file whose file name is found in the CustomToolOutput property. The RunCustomTool method controls the value of the CustomToolOutput property as follows:

  • If the CustomToolOutput property is blank, the project system creates an appropriate file name; this file name is based on the name of the ProjectItem object on which the RunCustomTool method was invoked.

  • If the CustomToolOutput property is not blank, the project system uses the existing value.

  • If the RunCustomTool does not execute successfully (returns an error in HRESULT), the CustomToolOutput property is set to an empty string.

  • The project item created by the RunCustomTool method replaces any project item previously created by the custom tool. If the custom tool does not execute successfully, then any project item previously created by the custom tool is removed from the project.

Before this method may be called, a custom tool must be associated with the ProjectItem by setting the CustomTool property of the of the ProjectItem object. The CustomTool property requires the program identifier for the tool.

Applies to