Project Model Updates in Rider 2019.3

Posted on by Matthias Koch

In this blog post, we will walk through some new features in Rider 2019.3 to help working with projects and solutions. The first part will cover new code inspections and quick-fixes for TFM definitions. In the second part we’ll cover managing solution and project configurations. The closing part will be about initial support for solution filters. Let’s get started!

Working with Target Framework Monikers

The new SDK-based project files are great, because they have become much simpler and easier to maintain. Even if you’re not using .NET Core yet, you might want to look at them. Maybe also at MSBuildSdkExtras, which makes multi-targeting much easier. However, there’s one annoying error message that probably everyone has run into when changing from one target framework to multiple:

Microsoft.NET.TargetFrameworkInference.targets(100, 5): The TargetFramework value ‘netcoreapp3.0;net472’ is not valid. To multi-target, use the ‘TargetFrameworks’ property instead.

Out of the box, most templates are generated with the TargetFramework property. As soon as we’re adding another target framework separated with a semicolon, we also need to change the property to TargetFrameworks (mind the additional s). Something that is pretty easy to miss, and could eventually cause some confusion.

With Rider 2019.3 we get the necessary code inspections and quick-fixes to conveniently tackle this issue! There is a context action with accompanying quick fix to easily switch between the two, and optimize the element name for us:

Quick-fix for specifying TFMs in project files

Solution Explorer and Build Configurations

Building solutions and projects is based on the idea of configurations. We can define multiple configurations, for instance, for Debug and Release, or for different platforms, like Xamarin or iOS. Previously, when a project was not enabled to build for a certain configuration, Rider indicated that with a "not built" label at the project node itself. With Rider 2019.3, this label is now represented as a link, which also shows the actual configuration in the tooltip:

Label indicating that a project is not built

Following the link, we can quickly open the solution configuration dialog under the given configuration and get an overview of which projects it builds or deploys, and which configurations are applied:

Build Configuration Manager

From here we can conveniently apply our intended changes – enable building a project, or change its project configuration. You can find more information in our documentation about Build Configurations.

Initial Support for Solution Filters

Rider 2019.3 also introduces initial support for solution filters, which allow to load and persist a defined subset of projects for a full solution. Not that we couldn’t handle large solutions 🙂 A simple solution filter file (.slnf) could look like this:

{
    "solution": {
    "path": "DemoSolution.sln",
    "projects": [
            "src\\ConsoleApp2\\ConsoleApp2.csproj",
            "src\\ReSharperDemo\\ReSharperDemo.csproj"
        ]
    }
}

With the latest version, we can open the solution filter files and the Solution Explorer will show a filtered indicator and with how many projects we’re dealing with:

Solution Filters in Solution Explorer

Expect more functionalities to come and watch RIDER-27139 to stay up-to-date.

Download Rider 2019.3 and give the new features a try. As always, your feedback is highly appreciated!

Subscribe

Subscribe to .NET Tools updates