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.
- Under Run/Debug Configurations, click the plus sign and pick Run external tool
- Set dotnet-watch, and make sure to set the proper Working Directory macro
$ProjectFileDir$
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
|
|
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.