Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Muyu-Chen opened this issue Jan 11, 2025 · 0 comments

Comments

@Muyu-Chen
Copy link

Muyu-Chen commented Jan 11, 2025

对于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.

@Muyu-Chen Muyu-Chen changed the title [Bug] 对于C#的支持不够完整,我提供了一种解决方案 [Bug] Provide solution to improve C# support 对于C#的支持不够完整,我提供了一种解决方案 Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant