How to enable dotnet watch in Jetbrains Raider
10 Mar 18 20:00
One minute read

Hi guys, while working on my pet API project in C# and .NET Core I realized that I miss having the debugger ‘watch’ for file changes.

The standard way of doing this in .NET Core 2.0 is to setup dotnet-watch . It seems that starting with .NET Core 2.1 this step isn’t going to be necessary, so one less step to do. Until then you can follow the official tutorial for setting up dotnet-watch.

In order to make it work in Rider, you need to do some simple steps.

  1. Under Run/Debug Configurations, click the plus sign and pick Run external tool Run/Debug Configurations
  2. Set dotnet-watch, and make sure to set the proper Working Directory macro $ProjectFileDir$ External tool

Update Since there’s no implicit way of setting up the ASPNETCORE_ENVIRONMENT in Rider before running the command, here’s a quick way of adding a parameter to your program to enable the switch.

Modify Program.cs

        public static IWebHost BuildWebHost(string[] args)
            var config = new ConfigurationBuilder().AddCommandLine(args).Build();
            var enviroment = config["environment"] ?? "Development";
            return WebHost.CreateDefaultBuilder(args)

Now you can run dotnet watch run --environment="Development" (or any other environment variable) and have the specific environment setup depending on your run configuration.

« Back to posts