JetBrains Fleet 1.33 Help

Manage .NET (C#) solutions, projects, and files

As Fleet supports a lot of different languages and technologies, it does not have a universal concept of a project, instead it operates with workspaces, where a workspace is a directory that contains everything associated with your current development task.

On the other hand, C# code is normally organized in projects and solutions, with corresponding configuration files (.csproj and .sln). If you have .csproj or .sln files in your workspace, JetBrains Fleet will help you open the corresponding projects and solutions in the dedicated view.

Work with solutions in a dedicated view

Im most cases when you work with C# code, you need to see code items organized in projects and solutions, which is the way you see code structure in traditional .NET IDEs like Visual Studio and JetBrains Rider.

JetBrains Fleet also lets you work with the solution structure — as soon as you enable Smart Mode in a workspace that contains a .NET solution, JetBrains Fleet opens the Solution tool.

JetBrains Fleet: Solution view for .NET (C#) projects

If the workspace contains a single .sln file, the solution opens automatically, otherwise you can choose what solution to open.

Manage .NET projects and solutions

To bridge the gap between workspace and project or solution in Fleet, you need to use the directory where the .csproj or .sln file resides as a workspace.

In the current version, Fleet has a user interface for creating projects, but it doesn't have the UI for creating solutions. However, you can always use the .NET command-line interface (CLI) for creating both projects and solutions. .NET CLI is included in the .NET SDK, which you should have installed as described in prerequisites.

Create a new project and solution

  1. Press ⌘ O or select File | Open from the menu.

  2. In the file browser, navigate to an empty folder where you want to store your code and click Open.

    This will open the desired folder as a workspace in the Files view.

  3. Press ⌃ ⇧ ` or choose View | Terminal from the menu to open the Terminal window.

  4. Make sure that the command line is in the root of the workspace, and create a new project from a dotnet project template. For example, we can create a new console application MyConsoleApp. To do so, type the following in the terminal:

    dotnet new console -o MyConsoleApp

    This command will create a new MyConsoleApp directory and place the project configuration file MyConsoleApp.csproj and an initial source file Program.cs in this directory.

  5. Use the dotnet sln command to create a new solution for your project. Let's call it FleetTestSolution. Type the following in the terminal:

    dotnet new sln --name FleetTestSolution

    To add the project to the solution, type

    dotnet sln add MyConsoleApp
  6. Now you can switch to the Files view to create and open project files from there.

Open an existing project or solution

  1. Press ⌘ O or select File | Open from the menu.

  2. Select the directory that contains the .csproj file of the target project or the .sln file of the target solution, and click Open.

When you first create or open a project or solution in JetBrains Fleet, you will see its file system structure in the Files view and have basic editor features as well as textual search.

When you enable the Smart Mode, JetBrains Fleet will analyze and index everything included in the solution, and you will be able to see the solution structure in the Solution view and access tons of code intelligence features.

If there are several .sln files in the directory or that you open, JetBrains Fleet will help you choose the solution you want to work with — after clicking the Smart Mode Status icon on the toolbar, click the link in the popup and select the desired solution.

JetBrains Fleet: Select a .NET solution from the directory

If you open a directory that contains one or more solutions in its subdirectories, the .NET-specific features and the Solution view will not be activated until you open a .NET-specific file (for example, .cs or .csproj).

Manage projects and files in your solution

Add a new project from the Solution tool

  1. Select View | Tools | Solution from the menu to open the Solution tool.

  2. Right-click the solution node and choose New Project....

  3. In the dialog that opens, specify a name for the new project and choose one of the project templates in the Type selector. Optionally, specify a custom project directory.

  4. Click Add to create the project and close the dialog.

Add a new project via command line

  1. Press ⌃ ⇧ ` or choose View | Terminal from the menu to open the Terminal window.

  2. Make sure that the command line is in the root of the workspace, where the solution's .sln file resides.

  3. Use dotnet project templates to create a project of the desired type.

    For example, to create a class library TestLib, type the following:

    dotnet new classlib -o TestLib
  4. To add the new project to the solution, use the dotnet sln add command, for example:

    dotnet sln add TestLib

Add C# files

  1. Do one of the following:

    • To create a new file in a specific project or folder, select this project or folder in the Solution or Files view and press ⌘ N or right-click and select New File.... Then type a filename with the .cs extension and press .

      JetBrains Fleet: New C# file in the Files view
    • To create a new file next to the file currently opened in the editor, make sure that the focus is in the editor and press ⌘ N or select File | New File... from the menu. Then type a filename with the .cs extension and press .

      JetBrains Fleet: New C# file in the editor
  2. Press and to choose the desired template for the new file and then press to select it.

    JetBrains Fleet: File templates in C#

Add references to other projects within the solution

  1. Use a type from a non-referenced project in your code. For example, if that project declares the class ArchiveFolder, you can type

    var archiveFolder = new ArchiveFolder();
  2. Place the caret to the name of the class, press ⌥ ⏎, and choose Reference project...:

    JetBrains Fleet: Add project reference in C#
  3. This will add a new project reference and the corresponding using directive.

Install NuGet packages

  1. Press ⌃ ⇧ ` or choose View | Terminal from the menu to open the Terminal window.

  2. In the command line, switch to the directory that contains the .csproj file of the target project.

  3. Type the following command:

    dotnet add package <package.name>

    For example, to install the JetBrains.Annotations package, v. 2022.1.0 type the following command:

    dotnet add package JetBrains.Annotations --version 2022.1.0

    For more information about dotnet CLI, refer to the Microsoft Docs.

Last modified: 12 April 2024