私はC#の新機能があり、cmdを使用してtest.cs
という基本的なhelloワールドファイルをコンパイルしようとしています。それには、次のものが含まれています'csc'が内部または外部のコマンド、操作可能なプログラムまたはバッチファイルとして認識されない
// Similar to #include<foo.h> in C++, includes system namespaces in a program
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// A name space declaration, a class is a group of namespaces
namespace Program1
{
class Hello // my class here, classes can contain multiple functions called methods which define it's behavior
{
static void Main(string[] args) // main method, just like in C/C++ it's the starting point for execution cycle
{
Console.WriteLine("Hello World");
Console.ReadKey(); // similar to _getch() in C++ waits for user to input something before closing
}
}
}
/*
* Other notes, .cs is a c# file extension
* cs files can be built via terminal by using csc foo.cs to generate foo.exe run it with foo
*/
私はラインcsc test.cs
私は次の出力を得る実行しようとすると:
は、環境変数のcsc部分ですか?おそらくコンパイラーはあなたのデスクトップにはありません(コマンドを実行しているルートを参照)。コンパイラがどこにあるかを調べてそこから実行したいかもしれません –
私の環境変数はどうやって見つけられますか?私はubuntu上のターミナルに少し慣れていますが、私はcmdを初めて使っています – Callat
'%SystemRoot%\ Microsoft.NET \ Framework64 \ v4.0.30319 \ csc.exe' csc testではなくtest.cs'を実行してください。ファイル拡張子付きの実行可能な 'csc'と、常に動作するように二重引用符で囲まれたフルパスを持つ' cs'です。パスは、コンパイルに使用する.NETフレームワークによって異なります。 – Mofi