.NET Tools News

C# Support in Fleet: Solution View, Unit Testing, and More!

Hello everyone!

It’s been a while since we published updates about C# support in Fleet. In that post, we shared our plans to deliver new features for our C# support to improve your experience as a .NET developer.

We’d like to give you a quick update regarding which to-do list items have been completed. As a reminder, most of these new features are available only in Smart Mode.

To download Fleet, please install the JetBrains Toolbox App. You will see Fleet in the list of available tools.

Solution View

Let’s start with a vital feature for C# developers – the Solution View.

Solution view tool window

If you open a solution (.sln file) or a .cs file from the Files view when Smart Mode is enabled, Solution View will be automatically focused. 

It shows you the solution structure you’re used to observing in your IDE of choice, including a list of projects in the solution, solution folders, and project dependencies (both NuGet and other projects from the solution), but hiding technical subfolders (like bin and obj folders).

Now let’s look separately at some additional features inside the Solution View that will simplify your daily .NET routine. 

Build / Rebuild / Clean actions

Right from the Solution View, you can now build, rebuild, and clean your solution by calling the context menu for the solution node. For a project node, the Build Project action is also available to you.

Creating a new project

You can add a new project to a solution by calling the context menu on a solution node in the Solution View. It provides some basic functionality like specifying the name of the new project, providing a project folder to save the project, and setting a type of project with a list of predefined types.

The UI and UX for this new dialog are still under construction and are subject to change.

Open Solution

Fleet can’t determine which solution to open if there are either several .sln files in the open folder or several .sln files available in the subfolders. In this case, you can use the Open Solution action to specify which solution to work with. At any point, you can use this action to select another solution and add it to Solution View.

If you want to close a particular solution, select the solution in Solution View and call the Close active solution action.

Unit Testing

Unit testing is also a critical feature, as being able to run and debug your unit tests is essential in the development workflow. We’ve now added Unit Testing functionality for C# to Fleet. Out of the box, Fleet supports the most common unit test frameworks: NUnit, MSTests v2, and xUnit

Run unit tests for different scopes

You can run unit tests right from Solution View. A new Run Unit Tests action is available in the context menu for a solution node, project node, and any C# file. 

Enable Smart mode in Fleet

If you’re used to seeing a green run icon for your unit test methods and classes in the code editor, we’ve got you covered! You can run your tests right from the gutter margin, which can be useful if you want to run only a particular unit test or a set of tests inside a class.

Debug unit tests

The green “run” gutter icon is the most straightforward way to start debugging any unit test you want. Set a breakpoint in the unit test’s code, click on the icon,  select Debug in the menu, and Fleet will attach the debugger to your test.

Run configurations for unit tests

If you run or debug unit tests, a new Run Configuration will be created and launched with a live presentation of the test execution reflecting the structure of the launched tests. There are three node statuses in the tree when the execution is complete: Passed, Failed, and Ignored

You can click the icons on the toolbar to quickly filter tests with a specific status. 

When a test has failed, the Log pane shows the exact message from the assert method and a link to quickly navigate to the failed unit test. Also, for the ignored unit tests this pane shows a description of why the test was marked as Ignored

You can also rerun the Run Configuration with the test by clicking the Rerun icon on the toolbar once you’ve fixed the failed test (or the code tested by the test). Even if you’ve closed the Run tool window, you can still rerun the Run Configuration for the unit test via the Run applet on the main Fleet toolbar or the Run | Run & Debug action from the main menu. 

Navigate to test source

Executing Navigate to test source from the context menu on a node in the unit test tree navigates you to the source code so that you can quickly get an idea of the test’s purpose. Double left-clicking also allows you to navigate to a unit test source.

Better support for projects with multiple target frameworks 

In the bottom right corner of the text editor, there is a new selector which allows you to select the target framework for an open file, which adds more context for the code analysis engine. 

Enable Smart mode in Fleet

A similar selector exists for files belonging to a shared project, helping you select the proper context for this file.  

Setting up Solution Properties

Now you can set up project properties for a whole solution via the UI to configure MSBuild to compile and build your projects properly:

  • Configuration, generally Debug or Release.
  • Platform, generally AnyCPU, x64, x86, or ARM64.

You can find them in the Solution Properties section on the Configure Workspace page.

New shortcut keymaps

We have added two additional keymap schemes. Now, you can choose either the Visual Studio scheme on Windows or the Visual Studio Code scheme on Windows, macOS, and Linux.

Broken Run Configurations

From time to time, everyone needs to demolish something that was implemented incorrectly and start rebuilding it from scratch. That’s what happened here – we’ve reworked the format for .NET Run Configuration to make it more convenient and unified, minimized duplicated properties (like properties that are already specified inside the launchSettings.json), and added useful ones like targetFramework and solutionPath

If you have already installed the Fleet 1.18 update, all of your old custom .NET Run Configurations have stopped working and you will have to update them manually to support the new format depending on their types.

“dotnet-launch-settings” type

If your custom Run Configuration has the dotnet_launch_settings type, you should do the following:

  • Rename it to dotnet-launch-settings.
  • Remove the exePath, commandName, and commandLineArg properties, which will be highlighted as errors on the run.json file.
  • If you’re working with a solution rather than a single project, you must specify a solutionPath property.
  • Optionally, specify the targetFramework property.

“dotnet” type 

If your custom Run Configuration has the dotnet type, you should do the following:

  • If you’re working with a solution rather than a single project, you must specify a solutionPath property.
  • Remove the exePath property, which will be highlighted as an error on the run.json file.
  • Optionally, specify the targetFramework property.

We’d love to hear your feedback

We look forward to hearing your thoughts about Fleet in general and its C# support in particular. This will help us shape the product. Here are several feedback channels for you to use:

Discover more