A.s. Bhullar A.s. Bhullar - 27 days ago 13
C# Question

How can I compile and run c# program without using visual studio?

I am very new to C#. I have just run C# 'Hello World' program using Visual Studio.

Can I run or compile a C# program without using Visual Studio?

If it is possible, then which compiler should I use?

Thanks

Answer

If you have the .NET v4 installed (so if you have a newer windows or if you apply the windows updates)

C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe nomefile.cs

or

C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe nomefile.sln

or

C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe nomefile.csproj

It's highly probable that if you have .NET installed, the %FrameworkDir% variable is set, so:

%FrameworkDir%\v4.0.30319\csc.exe ...

%FrameworkDir%\v4.0.30319\msbuild.exe ...
Comments