formulahendry / formulahendry/vscode-code-runner

[Bug] Provide solution to improve C# support 对于C#的支持不够完整,我提供了一种解决方案

Open
#1,206 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
2.4k
Forks
351
PR merge metrics
No merged PRs in 30d

Description

对于C#来说,我们需要通过dotnet run --project 才能运行一个项目(而不是脚本 script),然而如果我们转到csproj中运行,那这就不够**优雅**,因此我在配置中修改了文件,将路径修改了一下,修改为:
```
"csharp": "cd $dir && cd \"..\" && for /f \"tokens=*\" %i in (\"%cd%\") do dotnet run --project \"%cd%\\%~nxi.csproj\" && cd $dir",
```
这样的话,我们就可以直接运行和文件名同名的csproj了,对于visual studio创建的c#文件来说,这是默认的,我认为这样是相较来说更方便的一种方法。

For C#, we need to use dotnet run --project to run a project (rather than a script). However, if we have to switch to the .csproj file directory to run it, it becomes less elegant. To address this, I modified the configuration by updating the path as follows:
```
"csharp": "cd $dir && cd \"..\" && for /f \"tokens=*\" %i in (\"%cd%\") do dotnet run --project \"%cd%\\%~nxi.csproj\" && cd $dir",
```
With this modification, we can directly run the .csproj file that has the same name as the source file. For C# files created by Visual Studio, this is the default behavior. I believe this method is relatively more convenient.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.