JetBrains Rider EAP Survival Guide
Rider is a new .NET IDE from JetBrains, based on both the IntelliJ platform and ReSharper. If you haven't used products based on the IntelliJ platform before, this document will help you to find your way around some of the things that are different to what you're used to.
You can also check out the video of a recent Rider Tips and Tricks presentation.
Rider supports three different keymap schemes - the default IntelliJ keymap, and two schemes familiar to users of Visual Studio and ReSharper. On first run, Rider will show a welcome screen that allows choosing the keymap, as well as the UI theme.
The Visual Studio keymap corresponds to ReSharper set to use the Visual Studio scheme, while the ReSharper keymap is based on the legacy ReSharper 2.x keyboard scheme, referred to in ReSharper as "IntelliJ IDEA", as previous versions of ReSharper had keyboard shortcuts based on IntelliJ IDEA at that time. The standard IntelliJ IDEA keymap has evolved since then, while the ReSharper keymap hasn't changed to match.
Once the keymaps are set appropriately, navigating Rider should be very familiar. But there will still be some differences. To help find an action, use the Search Everywhere feature (Shift+Shift) or Go To Everything feature (F12 or Ctrl+B, depending on keymap). This will search not only your code, but also actions and preferences. To help learning shortcuts, actions will show their corresponding shortcuts in the list of results.
Opening an existing project
Rider can open existing projects, using the standard IntelliJ platform Open dialog. This is a custom dialog, rather than the standard OS file dialogs, as the IntelliJ platform allows opening a project from a file, or from a folder, which the OS dialogs don't allow.
Rider will open a standard Visual Studio .sln solution file, or a project.json based .NET Core project. Simply navigate to the folder containing the .sln or project.json file, select it and click OK. Rider will generate a .sln file and a .xproj file when opening a .NET Core project.
Rider also allows opening a project from source control. It can, for example, log in to GitHub, and clone a repo to the local file system. Once done, it will prompt to open the folder. Rider does not support opening folders — it can only open .sln files. Manually navigating to the .sln file will open the file.
Please see the following links for the documentation for the IntelliJ platform (but please bear in mind that there will be minor differences with implementations and user interfaces):
- Opening, Reopening and Closing Projects
- Welcome Screen (Rider does not require the IntelliJ platform's import project feature)
- Version Control with IntelliJ IDEA
When opening a .NET Core project, Rider will automatically restore all packages. Rider will also detect the list of target frameworks from project.json, and display them in a chooser in the status bar. Selecting the current target framework sets the context for the editor - what compiler defines are active, and what packages and assemblies are referenced.
Creating a new project
Rider provides a number of templates for creating a new project.
The New project dialog has templates to create an empty project, standard .NET class libraries and applications, as well as test projects. It will also create .NET Core projects, as console applications, testing and class libraries. Simply enter the solution and project name, select a location, and click Create.
Once a project has been created, files can be added or removed by right clicking on the project node in the Solution Explorer.
Rider supports adding references to standard .NET Framework projects by right clicking a project node and selecting Add Reference. The resulting dialog can be searched, just by typing, or the Add From... button can be used to reference a file on disk.
This dialog is not available in .NET Core projects. Instead, references should be added by directly editing the project.json file. Rider will automatically reload the project and restore the new package references. (This dialog does not exist because Microsoft is replacing the project.json file with a traditional .csproj file, at which point, Rider will add the appropriate support).
Rider supports installing, updating and removing NuGet packages, via the NuGet tool window. Rider will automatically restore missing packages when a project is opened.
The NuGet tool window allows managing packages for the projects in your solution. The list of projects shows how many packages are installed, and if any of them have available updates. Selecting a project allows searching for a package and installing, updating or removing the package from that project. Selecting the solution allows working with all or some of the projects at once.
The search box in the second pane will search the currently selected NuGet package source. The results are cached and updated in the background, so searching for common packages is very quick.
Once a package is selected, the details pane will show available versions and selected projects, as well as details about the package itself.
The NuGet tool window includes Sources, Options, Caches and Log panes. The Sources pane lists the currently applied NuGet.config files, as well as showing the current effective settings. Selecting one of the files in the list will open it in the editor.
The Options pane allows setting options on how Rider will apply NuGet operations, such as including pre-release packages, and what dependency behavior to use.
The Caches pane lists the cache locations used by NuGet itself, as well as the current usage size. Selecting an item will allow opening the folder or clearing the cache.
The Log folder shows the log of all NuGet operations, which can be useful for diagnosing issues.
Building a project
Rider can build .NET Core projects and MSBuild based projects.
For .NET Core projects, it requires the .NET Core SDK to be installed, and will automatically detect the dotnet executable. This can be manually set in Options.
For .NET Framework projects, Rider will use MSBuild or Mono’s XBuild to build your solution and projects. This means that Rider can build any project that is MSBuild based (e.g. .csproj). Again, Rider will automatically detect the location of Mono, which can also be manually set in Options. Rider will of course automatically detect the location of MSBuild and the .NET Framework on Windows.
Rider displays a toolbar at the top right of the UI that allows selecting the current build configuration (e.g. Debug and Release) as well as the build target (e.g. Any CPU).
The keyboard shortcuts for building depend on the keymap selected during first run, or via the Preferences dialog. The standard IntelliJ shortcuts are Ctrl+F9 on Windows, or ⌘+F9 on macOS, and Ctrl+Shift+B for Visual Studio or ReSharper keymaps. Alternatively, a build can be started from the Build menu.
When running a build, the MSBuild or XBuild output is shown in the Build tool window, in the Output tab. Once complete, the errors and warnings are shown in the Errors tab.
Running and debugging a project
Rider uses the IntelliJ platform's Run/Debug Configuration concept for defining how a project should be run or debugged. Rather than each project having a single set of debug settings (command line args, working directory, optional executable), the solution can have multiple run configurations. When a project is first opened or created, Rider will create a default configuration, based on the project type.
To create a configuration, use the Edit Configurations item in the drop down toolbar on the main window. This dialog will list available configurations, and allow adding new ones, via the "plus" icon. When the dialog first opens, there will be no configurations, only the Defaults node in the tree list. This lists the available templates, and allows changing the default values for these templates.
When clicking the "plus" icon, Rider will offer a menu of the templates that can be used. For example, to set up a run configuration for an executable project, you can select the .NET Project template. You will be asked to supply a name, choose the project from the solution in the drop down, and also pass in command line arguments. You can also add a set of steps that can be run before the project's executable is launched. By default, the first step is Build solution before run, which makes sure the project is up to date. But other steps are available — you can run another configuration, or run an external tool that you can also configure.
The configuration templates available are:
|.NET Executable||Run a .NET executable. Requires a full path to the executable to run. Allows specifying command line arguments.|
|.NET Project||Runs a .NET executable project. Does not require a full path to the output of the project — Rider will retrieve this automatically. Also allows specifying command line arguments. For .NET Core projects, Rider will automatically call the dotnet executable from the .NET Core SDK. You will be able to select the target framework (e.g. .NETCoreApp or .NET Framework)|
|Compound||Creates a run configuration from other run configurations. Allows running multiple run configurations at once.|
Once a configuration has been created, it is added to the toolbar at the top of the main window.
This drop down allows selecting the current configuration, and will be the configuration used for the Run or Debug action, available in the icons next to the drop down, and also in the Run menu.
The keyboard shortcuts are dependent on the current keymap. For the Visual Studio or ReSharper keymaps, this is F5 to run and Alt+F5 to debug. For IntelliJ, this is Shift+F10 to run and Shift+F9 to debug.
When running, the application's output is shown in the Run tool window, which also includes a toolbar for stopping and restarting the application.
To debug, set breakpoints by clicking in the margin of the text editor, or use the menu item in the Run menu. When debugging, the debugger uses the IntelliJ platform's standard Debug tool window. More details can be found in the IntelliJ IDEA documentation.
Rider also supports break on exception and setting the next statement to be executed.
Note that Rider can debug .NET Core applications, but only if the
debugType is set to
portable in project.json. Rider will prompt you if this isn’t set.
Rider supports running unit tests, just like ReSharper. Tests are discovered and highlighted in the editor, with icons displayed in the editor gutter. Hitting Alt+Enter on a test class or method will allow for running or debugging the tests.
Rider supports xUnit.net and NUnit tests. It does not support MSTest. It will run tests for standard .NET Framework projects, and also for .NET Core projects. If a .NET Core project contains multiple target frameworks, each test will be listed twice, once for each target framework. Hitting Alt+Enter on a test will run or debug with the currently selected framework (selected from the switcher available in the status bar).
Rider does not support .NET Core tests that target .NET Framework, but run on Mono. This is a limitation of
dotnet test, which does not work correctly in this situation on Mono. We are investigating workarounds.
Rider does not yet include all of ReSharper’s option pages, which means various ReSharper options cannot be modified directly.
There is a very basic Code Style preferences page to allow changing tab and space indent values, and Rider allows setting the Colors & Fonts for Rider file types, such as C#.
You can modify options in ReSharper for Visual Studio and use the Save To button to save the changes to the .sln.dotSettings team shared file (to be checked into source control) or the .sln.dotSettings.user personal settings file (to be excluded from source control). Rider will use these settings.
The Build, Execution, Deployment options pages allow Rider to edit options for the Debugger, as well as specify the location of the dotnet executable from the .NET Core SDK, as well as the location of Mono. Rider will attempt to automatically find these executables.
Work in progress
The following items are being worked on as part of the EAP (not an exhaustive list):
- ReSharper Options (see above)
- Opening a project in a new window: Rider currently does not support opening multiple solutions in the same window, or running multiple windows.
- Running .NET Core tests for .NET Framework target on non-Windows:
dotnet testdoes not support running .NET Core tests that target the .NET Framework on Mono. We are investigating a workaround.
Out of scope
The following items are currently out of scope for the EAP and Release:
- WinForms or WPF designers