External tools
Configure third-party command-line applications as external tools to run them from JetBrains Rider. For example, your workflow may require running a specific script, code generator, analyzer, preprocessor or postprocessor, some database utility, and so on. By configuring it as an external tool, JetBrains Rider provides a dedicated action for it, which you can run from the main menu, from certain context menus, assign a shortcut to it, or run it when launching a specific run configuration.
You can use built-in IDE macros to pass context-dependent command-line arguments to the tool, such as the current file or your project source path. If necessary, JetBrains Rider will print the tool's output to the console.
JetBrains Rider supports the following types of external tools:
Custom MSBuild tools help you run external tools custom MSBuild tasks outside current projects.
Local tools run locally on your computer.
Remote tools are executed on a remote server over SSH.
Add a custom MSBuild tool
You can configure custom tools (MsBuild with custom arguments or an external executable) that automatically process specific files when they changed. For example, JetBrains Rider generates code from .resx files using the ResXFileCodeGenerator
tool (this association is built-in).
Suppose, you need to generate .aspx.designer.cs files when editing .aspx files. You can do this using Redesigner, an open source WebForms generator.
To have Redesigner as an executable, either build it from sources or download the Redesigner.exe build with the .NET Framework 4.6.2 from JetBrains website.
Press Control+Alt+S to open the IDE settings and then select
.Click and provide all necessary details:
Name: — arbitrary name to identify the tool.
Extensions: — comma-separated list of file extensions (without dots) that should be processed by the tool.
Path: — to make sure that the path is specified correctly, click ... and use the file chooser dialog.
Args: — command-line arguments for the tool. To make the arguments work for different solutions and projects, use the macros that are explained in the dialog. Note that command-line arguments are often sensitive to whitespaces in file paths, so don't forget to surround file paths with quotes. Command-line arguments for Redesigner.exe can look like this:
-r "$PROJECT_FOLDER$" -w "$PROJECT_FOLDER$\bin\$PROJECT_NAME$.dll" "$FILE$"
Click Save in the Settings dialog to apply the modifications and let JetBrains Rider choose where to save them, or save the modifications to a specific settings layer using the Save To list. For more information, refer to layer-based settings.
A configured custom tool will be triggered every time you edit a file that have a specified extension. You can also trigger it manually by right-clicking a file in the Solution Explorer and choosing Execute [tool name] from the context menu.
If a custom tool provides some output, you can find it in backend.log ( ).
Add a local external tool
This example demonstrates how to add OptiPNG as an external tool and use it to optimize images in your project.
Press Control+Alt+S to open the IDE settings and then select
.Click and specify the tool's settings.
For more information, refer to External Tools.
In our case,
OptiPNG
will be run with the-o4 $FilePath$
arguments. You can use macros that can refer to the project name, the current file path, a path to the PHP executable, and so on. Clicking will open the Macros dialog that lists all available macros and their values.Click OK to add the tool and then apply the changes.
Run the added local external tool
To open the selected file in the newly added toolimage, do one of the following:
Go to
.Right-click a file in the Project tool window and select from the context menu.
Create a shortcut to run the tool.
Press Control+Alt+S to open the IDE settings and then select Optimize PNG action under the External Tools node, and assign a shortcut for it.
. Find the
When you run the tool, the output is displayed in the Run tool window.
Add a remote external tool
Remote SSH external tools are configured similarly to local external tools, but also define the remote server on which they are executed and require credentials for connecting to it via SSH. For more information about working with the built-in SSH terminal, refer to Run SSH terminal.
This example demonstrates how to add date
as a remote SSH external tool that is executed on a remote server over SSH and returns the current date and time on it.
Press Control+Alt+S to open the IDE settings and then select
.Click to open the Create Tool dialog.
This dialog provides the same set of settings as when you add a local external tool, but also allows you to select a remote connection. If you don't specify the connection settings, JetBrains Rider will ask you for the host, port, and relevant SSH credentials every time you run the tool on the server. For more information, refer to Remote SSH External Tools.
Click OK to add the tool and then apply the changes.
Run the added tool on a remote server
Do one of the following:
Go to
and the name of the added remote external tool.Create a shortcut to run the tool.
Press Control+Alt+S to open the IDE settings and then select
. Find the action with the name of your configured remote external tool, and assign a shortcut for it.
After you specify the host, port, and credentials, JetBrains Rider will connect to the server via SSH and run the date
command, returning the output to the Run tool window in JetBrains Rider.
Web browsers
You can preview any HTML file that is open in the editor in a web browser of your choice.
Open a file in a web browser
To open a file that is intended to be rendered by a web browser (HTML, XML, JSP, and so on), do one of the following:
Open the file in the editor and press Alt+F2.
Right-click the file in the Project tool window and select Open in Browser.
Go to View | Open in Browser.
Use the browser popup in the top right part of the editor window (appears on hover). Click the browser button to open the web server file URL, or Shift+LeftClick it to open the local file URL.
The Open in Browser action is not available for other file types. However, you can still execute it using Find Action Control+Shift+A.
View and configure the list of browsers
In the Settings/Preferences dialog (Control+Alt+S), select Tools | Web Browsers and Preview.
If a browser was installed using a standard procedure, the alias in the Path field should point to the right location. If it does not, specify the path to the corresponding executable file.
Use custom profile and settings
You can configure custom profiles for Firefox and Chrome family browsers.
In the Settings/Preferences dialog (Control+Alt+S), select Tools | Web Browsers and Preview.
Select the browser in the list and click .
For Firefox, specify the path to the profiles.ini file and choose the profile to use. For more information, refer to Firefox browser profile.
For Chrome, select Use custom user data directory and specify the location of the user data directory.
You can also specify additional command-line options to use when running Chrome from JetBrains Rider. For more information, open
chrome://flags
in the Chrome address bar.