在运行Kestrel服务器时构建.NET核心应用程序 [英] Build a .NET core application while running Kestrel server

查看:170
本文介绍了在运行Kestrel服务器时构建.NET核心应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在经典的.NET应用程序中,我将设置本地IIS以运行指定的应用程序.我可以构建应用程序并点击端点以立即查看更改.我不需要每次都启动调试器.我想通过使用Kestrel服务器的.NET Core实现此目的.

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.

我可以通过从命令行运行dotnet run来运行我的应用程序.但是,当我尝试构建时,文件正在使用中,并且构建失败.是否有任何开发配置选项不会锁定文件,而是仅根据需要运行它们,从而使我能够立即构建和测试更改?

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?

推荐答案

使用Watcher工具扩展dotnet-cli是可行的方法.简而言之-参考

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> 

文件中的

,然后从命令行运行dotnet watch run.这样您就可以更改将自动重新编译的代码.

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

这篇关于在运行Kestrel服务器时构建.NET核心应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆