简体   繁体   English

如何从 C# 的 Code Runner(VSCode 扩展)运行命令中删除文件路径?

[英]How to remove the file path from the Code Runner (VSCode extension) run command for C#?

When using the VSCode extension Code Runner for my C# .NET 6 console app, after hitting the run button, the following command runs in the terminal:当为我的 C# .NET 6 控制台应用程序使用 VSCode 扩展Code Runner时,点击运行按钮后,以下命令在终端中运行:

 ❯ do.net run "/home/USER/code/c#/MyApp/Program.cs" Hello, World! ~/code/c#/MyApp ❯

I am wondering how to remove the file path after ' do.net run '.我想知道如何在“ do.net run ”之后删除文件路径。 Given that I am already in the console application directory, I would like for the extension to only execute the ' do.net run ' command, which would achieve the same result.鉴于我已经在控制台应用程序目录中,我希望扩展只执行“ do.net run ”命令,这将获得相同的结果。 I can demonstrate this by running the command myself without including the file path to the 'Program.cs' file at the end:我可以通过自己运行命令来证明这一点,但最后不包括“Program.cs”文件的文件路径:

 ❯ do.net run Hello, World! ~/code/c#/MyApp ❯

This is purely an aesthetic matter, but it has been bugging me a lot and I've spent more than two hours now trying to figure out a solution for this.这纯粹是一个美学问题,但它一直困扰着我,我现在已经花了两个多小时试图找出解决方案。

  1. Go to settings in vs code Go 到 vs code 中的设置
  2. In the search bar, type "user se"在搜索栏中,输入“user se”
  3. You will see Edit in settings.json, click on it你会在settings.json中看到Edit,点击它
  4. Add "code-runner.showExecutionMessage": false,添加“code-runner.showExecutionMessage”:false,

Enjoy享受

  1. Go to Vs code setting Go转VS码设置

  2. Uncheck Show Execution Message option取消选中显示执行消息选项

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

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