JetBrains Rider 2019.2 Help

External tools

You can define standalone third-party applications as external tools and run them from JetBrains Rider. For example, you might want to run a code generator or analyzer, preprocessor or postprocessor, a database utility, and so on.

You can pass contextual information from your project to the external tool as command-line arguments (for example, the currently selected or open file, the project source path, and so on), view the output produced by the tool, configure to launch the tool before a run/debug configuration, and more.

There are different types of external tools that you can use with JetBrains Rider:

  • Custom MSBuild tools help you run external tools custom MSBuild tasks outside current projects.

  • Local external tools are applications that run locally on your machine.

  • Remote SSH external 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.

  1. 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.

  2. In the Settings/Preferences dialog (Ctrl+Alt+S), go to Tools | Custom Tools.

  3. Click the Add button 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$"

    JetBrains Rider: Adding custom a tool that automatically processes specific files
  4. Click Save 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, see 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 (Help | Show Lot in Explorer/Finder).

Add a local external tool

This example demonstrates how you can add OptiPNG as an external tool and use it to quickly optimize images in your project from JetBrains Rider.

  1. In the Settings/Preferences dialog (Ctrl+Alt+S), select Tools | External Tools.

  2. Click the Add button and specify the following settings:

    The Create Tool dialog
    • Name: The name of the tool that will be displayed in the JetBrains Rider interface (the Tools menu and context menus).

    • Group: The name of the group to which the tool belongs. You can select an existing group or type the name of a new group.

    • Description: A meaningful description of the tool.

    • Program: The name of the executable file. Specify it with an absolute path if the containing directory is not in your PATH environment variable.

    • Arguments: The arguments passed to the executable file, as you would specify them on the command line.

    • Working directory: The path to the current working directory from which the tool is executed.

    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 the Insert macro button will open the Macros dialog that lists all available macros and their values.

  3. Click OK to add the tool and then apply the changes.

To run the added tool on the selected class file image, do one of the following:

  • From the main menu, select Tools | Images | Optimize PNG.

  • Right-click a file in the Project tool window and select Tools | Images | Optimize PNG from the context menu.

  • In the Settings/Preferences dialog (Ctrl+Alt+S), select Keymap, find the Optimize PNG action under the External Tools node, and assign a shortcut for it. Use the shortcut to run the tool.

    Create a shortcut for an external tool

When the tool runs, its output is displayed in the Run tool window:

Running External Tool

Add a remote SSH 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 details on working with the built-in SSh terminal, see Running SSH Terminal.

This example demonstrates how you can add date as a remote SSH external tool that is executed on a remote server and returns the current date and time on it.

  1. In the Settings/Preferences dialog (Ctrl+Alt+S), select Tools | Remote SSH External Tools.

  2. Click the Add button and specify the following settings:

    The Create Tool dialog

    This dialog provides the same set of settings as when you add a local external tool, but selecting the remote server is also suggested. This can be one of your configured deployment servers or a Vagrant box. By default, JetBrains Rider will ask you for the host, port, and relevant SSH credentials every time you run the tool on the deployment server.

  3. Click OK to add the tool and then apply the changes.

To run the added date tool on a remote server, do one of the following:

  • From the main menu, select Tools | Remote tools | Date and time.

  • In the Settings/Preferences dialog (Ctrl+Alt+S), select Keymap, find the Date and time action, and assign a shortcut for it. Use the shortcut to run the tool.

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:

  • Press Alt+F2.

  • Right-click a file and select Open in Browser.

  • From the main menu, select View | Open in Browser.

  • Use the browser popup in the top right part of the editor window. Click the browser button to open the web server file URL, or Shift+Click 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 Ctrl+Shift+A.

By default, JetBrains Rider supports some of the most popular browsers, which are configured automatically, if available:

  • Chrome Chrome browser icon

  • Firefox Firefox browser icon

  • Safari Safari browser icon

  • Opera Opera browser icon

  • Internet Explorer Internet Explorer browser icon

  • Edge Edge browser icon

View and configure the list of browsers

  • In the Settings/Preferences dialog (Ctrl+Alt+S), select Tools | Web Browsers.

The Web Browsers page in Preferences

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.

The order of browsers in the list corresponds to their order in the popup, context menu, and the View menu. If you disable a browser, it will not appear in the popup, context menu, and the View menu.

Add a custom browser

  1. In the Settings/Preferences dialog (Ctrl+Alt+S), select Tools | Web Browsers.

  2. Click the Add button and specify the browser name, family, and location of the executable file or macOS application.

Select a default browser

The Open in Browser item in the View menu and in the context menu of a file lists all available browsers and the default browser, which is also used to render external resources.

  1. In the Settings/Preferences dialog (Ctrl+Alt+S), select Tools | Web Browsers.

  2. From the Default Browser list, choose one of the following:

    • System default: use the default browser for your operating system.

    • First listed: use the first browser in the list.

    • Custom path: use a browser that is not in the list. Specify the location of the executable file.

Use custom profile and settings

You can configure custom profiles for Firefox and Chrome family browsers.

  1. In the Settings/Preferences dialog (Ctrl+Alt+S), select Tools | Web Browsers.

  2. Select the browser in the list and click the Edit button.

    • For Firefox, specify the path to the profiles.ini file and choose the profile to use. For more information, see 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.

Last modified: 18 October 2019