简体   繁体   English

观看ASP.NET Core 2.0应用

[英]Watching an ASP.NET Core 2.0 app

I have a new ASP.NET Core 2.0 app. 我有一个新的ASP.NET Core 2.0应用程序。 By "new", I mean, it is a brand new project created via Visual Studio 2017. From the command-line, I can type dotnet run and my app will load just fine. 我的意思是“新”,这是一个通过Visual Studio 2017创建的全新项目。从命令行中,我可以键入dotnet run并且我的应用程序将正常加载。 However, I want to have hot reloads during my development. 但是,我想在开发过程中进行热重装。 So, I tried running dotnet watch run . 因此,我尝试运行dotnet watch run When I run this command, I receive the following error: 运行此命令时,出现以下错误:

No executable found matching command "dotnet-watch" 找不到与命令“ dotnet-watch”匹配的可执行文件

I assumed this meant that the DotNet Watcher Tools were not installed. 我认为这意味着未安装DotNet Watcher工具 However, I verified that they are in fact installed via Nuget. 但是,我验证了它们实际上是通过Nuget安装的。 What am I missing? 我想念什么? How do I watch an ASP.NET Core 2.0 app for changes? 如何观看ASP.NET Core 2.0应用程序的更改?

Thank you 谢谢

As of version 2 of this tool, I was receiving the same error. 从该工具的版本2开始,我收到了相同的错误。 My mistake was installing the package via NuGet. 我的错误是通过NuGet安装软件包。 Instead, follow the instructions at https://docs.microsoft.com/en-us/aspnet/core/tutorials/dotnet-watch 相反,请按照https://docs.microsoft.com/zh-cn/aspnet/core/tutorials/dotnet-watch上的说明进行操作

  1. Add a Microsoft.DotNet.Watcher.Tools package reference to the .csproj file : 将Microsoft.DotNet.Watcher.Tools程序包引用添加到.csproj文件

    <ItemGroup> <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="2.0.0" /> <DotNetCliToolReference Include =“ Microsoft.DotNet.Watcher.Tools” Version =“ 2.0.0” />
    </ItemGroup> </ ItemGroup>

  2. Install the Microsoft.DotNet.Watcher.Tools package by running the following command: 通过运行以下命令来安装Microsoft.DotNet.Watcher.Tools程序包:

    dotnet restore 点网还原

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM