Build a .NET core application while running Kestrel server
Asked Answered
J

1

3

In classic .NET applications, I'd set up my local IIS to run the specified application. I could build the application and hit the endpoint to see the change immediately. I did not need to launch the debugger every time. I want to achieve this with .NET core using Kestrel server.

I'm able to run my application by running dotnet run from the command line. However, when I try to build, the files are in use and the build fails. Are there any development configuration options that do not lock down the files and instead run them only as needed, allowing me to build and test changes immediately?

Jandy answered 6/4, 2017 at 10:0 Comment(0)
M
6

Extending the dotnet-cli with the Watcher-tool is the way to go. In short - reference

<ItemGroup>
  <DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="1.0.0" />
</ItemGroup> 

in your .csproj file and then run dotnet watch run from the commandline. That'll allow you to make changes to the code which will automatically recompile.

dotnet-watch

Merriott answered 6/4, 2017 at 10:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.