Build a .NET core application while running Kestrel server

▼魔方 西西 提交于 2019-12-08 02:51:49

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/43251844/build-a-net-core-application-while-running-kestrel-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!