Populating and Extending Your Solution
Adding code and resources
In JetBrains Rider, all code and resource files are added using editable file templates. When you choose the node in the Solution Explorer where you want to add a new file, just press Ctrl+Alt+Insert or right-click and choose Add, and then pick the desired template for the new file.
File templates are configurable on thepage of JetBrains Rider settings (Ctrl+Alt+S).
Adding project and assembly references
Rider supports adding references to other projects in your solution as well as to standard .NET Framework assemblies 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 .sproj 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).
Adding external files and folders
With Rider, you can extend solutions by adding external files and folders. For example, you can have your test data, logs, or any other files and folders right next to your solution. These additional items in the solution are not saved in project or solution configs, but rather in Rider's own settings.
External items in the solution are indexed by Rider, so you can enjoy instant search (Ctrl+Shift+F) and navigation (Ctrl+T) among other things for those items. However, external solution items will stay beyond the scope of your solution when you perform any of the solution-wide refactorings.
For external solution items that share their VCS root with the solution, all version-control features will also be available.
To add an external folder to the current solution, right-click on the solution in the Solution window, choose Attach Existing Folder, and then select a folder. Rider will turn on the Show All Files mode in the Solution Explorer so that you can start exploring the attached folder:
Please note the difference between adding external folders to your solution and adding existing files/folders/projects to your solution.
The latter is done by choosing Add Existing Project from the context menu on the solution or solution folder, or by choosing Add Existing Item from the context menu on a project or folder — these kinds of modifications are saved in solution and project configs so you will also see the added items if you open the solution in Visual Studio.
When working with external items in the extended solution, note the following:
- You can always hide the external items by right-clicking on the Solution Explorer title bar and clearing the Show All Files check box.
- To remove an external directory or any of its subdirectories from the solution, right-click on that item and choose Exclude from Solution Structure. An original external directory will be just removed, but a subdirectory will be marked red as non-indexed — in any case the directories will not be removed from disk.
- If external items contain any .NET solutions or projects, code analysis in those items will not be available. To work with multiple solutions simultaneously, open them in different windows.
- You can attach any external folder that is a parent directory with respect to your solution location. In this case, your solution will be displayed inside the hierarchy of that folder as long as the Solution Explorer is in the Show All Files mode.
Browsing non-solution files and folders
One way of exploring non-solution items is to add external items to your solution. But Rider also allows you to open and explore any files and folders even without any solution being open. This way you can work on web projects that do not have a Solution file or just study any text file in Rider's editor.
To open a file or a folder, press Ctrl+O or choose
A file will be just opened in the editor but not added to the solution view. If you choose to open a folder while a solution is loaded, Rider will suggest two options: you can either add it as an external folder to the solution or open the folder in a new application window.