16

当我在 Rider (net core) 中按下运行按钮时,它运行以下命令:

/usr/local/share/dotnet/dotnet /pathtomyproject/myproject.dll

但是我需要使用参数“watch”运行项目,如果我在 Rider Edit Configurations 的参数中编写此命令,则会出现错误:

Unhandled Exception: System.FormatException: Unrecognized argument format: 'watch'.

我知道使用 watch tool is 运行dotnet watch run,我也知道我可以在终端中运行该命令。

我的问题是,当我按下运行按钮时,是否可以将 Rider 配置为以这种方式运行?或者......也许 Rider 有一个我不知道的编辑和继续功能?

4

2 回答 2

22

Rider 论坛上有一个答案:https ://rider-support.jetbrains.com/hc/en-us/community/posts/360001346139-Simpler-integration-for-Microsoft-DotNet-Watcher-Tools

简而言之:

  1. 打开运行配置对话框
  2. 添加新的“启动前”配置
  3. 选择“外部工具”
  4. 填写“工具设置”部分(见上面的链接)

编辑

外部工具设置应为:

  • 程序: c:\program files\dotnet\dotnet.exe
  • 论据: watch run
  • 工作目录: <path to your project folder>
于 2017-10-04T11:30:00.540 回答
5

您可以使用“Native Executable”选项作为运行配置来实现这一点。为此:

  1. 从菜单选项中选择运行 -> 编辑配置

  2. 单击 + 图标并从列表中选择“本机可执行文件”选项。

  3. 在显示的选项中,提供以下...

    • 名称:手表(或任何你喜欢的)
    • exe路径:/usr/local/share/dotnet/dotnet
    • 程序参数:watch run
    • 工作目录:[.csproj 文件所在项目的路径]
  4. 单击“确定”以应用/保存更改。

  5. 准备就绪后,从菜单选项中选择运行 -> 运行...。选择“观看”选项。

您应该会看到构建/运行应用程序的终端结果。如果您更改控制器文件,您将看到检测到文件更改并重新构建应用程序。

于 2019-02-15T23:59:31.717 回答