I have a folder called z-lib structured as:
z-lib
cpp
java
python
csharp
a.cs
...
I want to run a.cs file using CMD + B keyboard combo on VS Code (macbook).
Tried
In my settings.json, I have so far set up:
"csharp": "dotnet build $dir$fileName && dotnet run $dir$fileName",
which returns:
MSBuild version 17.9.8+b34f75857 for .NET
/Users/4a/Downloads/z-lib/csharp/a.cs(1,1): error MSB4025: The project file could not be loaded. Data at the root level is invalid. Line 1, position 1.
Build FAILED.
/Users/4a/Downloads/z-lib/csharp/a.cs(1,1): error MSB4025: The project file could not be loaded. Data at the root level is invalid. Line 1, position 1.
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.04
also tried:
// "csharp": "cd $dir && dotnet run --project $dir$fileName",
// "csharp": "cd $dir && dotnet build $fileName && dotnet run $fileName",
// "csharp": "dotnet build $fileName && dotnet run $fileNameWithoutExt",
a.cs
using System;
public class b {
public static void Main()
{
Console.WriteLine("Hello world!");
}
}
How do I automatically run a cs file using CMD + B? What do I change in the settings.json?