JetBrains Rider带着手表跑

Yur*_*les 9 c# jetbrains-ide watch .net-core rider

当我在Rider(网络核心)中按下运行按钮时,它运行以下命令:

/usr/local/share/dotnet/dotnet /pathtomyproject/myproject.dll
Run Code Online (Sandbox Code Playgroud)

但我需要使用参数"watch"来运行项目,如果我在Rider Edit Configurations的参数中编写此命令,我会收到错误:

Unhandled Exception: System.FormatException: Unrecognized argument format: 'watch'.
Run Code Online (Sandbox Code Playgroud)

我知道用watch工具运行是dotnet watch run,我也知道我可以在终端中运行该命令.

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

小智 14

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

简而言之:

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

  • 有一个选项可以将调试器附加到运行`dotnet watch run`任务上,这将是一件好事.现在我在两种配置之间切换.默认为调试,第二个为连续构建,无需调试. (6认同)
  • 该链接不再可用 (4认同)
  • 链接更改为:https://rider-support.jetbrains.com/hc/en-us/community/posts/360001346139-Simpler-integration-for-Microsoft-DotNet-Watcher-Tools(我用新的更新了答案关联) (2认同)

Dil*_*e-O 5

您可以使用“本机可执行文件”选项作为运行配置来实现这一点。为此:

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

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

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

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

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

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