Command line compiling C# error

I just started learning C# today, but Visual Studio can compile it, good guy. The command line does not compile.
Oh, yes, if you report this error at the beginning

'csc' is not recognized as an internal or external command, operable program or batch file.

It means that you have not configured environment variables. . . . . .

The following error means that your environment variables are wrongly matched. . . . .

This compiler is provided as part of the Microsoft ® .NET Framework, but only supports language versions up to C# 5, which is no longer the latest version. For compilers that support newer versions of the C# programming language, see http://go.microsoft

So, how to solve it, open the environment variable, that is, directly search for the environment variable in the search box, or open it through the control panel.
Edit the system environment variable, double-click Path, and add it.
Give it the Ros address under the bin where you installed vs, mine is this

D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Roslyn

1
Then confirm the operation, get it done,
then csc helloworld.cs
and then helloworld
and congratulations, it’s a success!

Guess you like

Origin blog.csdn.net/qq_43738932/article/details/126146969