Today I have come across executing C# (C Sharp) code with out Visual Studio, but you must have .NET Framework installed on your computer.
- Install .NET Framework, if not installed.
- Set the path of the .NET Framework Edition in environment variables or by using SET PATH command. ex: C:\Windows\Microsoft.NET\Framework\v3.5
- Write the C# script, Save file with extension .cs
public class Example
public static void Main()
Console.ReadLine(); //Waits until user press Return(Enter) key
- Open command prompt, change the directory to specified folder(ex: D:\csharp\)
- Execute the following command cmd> csc trail.cs
- We will get trail.exe in the specified folder(ex: D:\csharp\), if it executed successfully
- Double click the trail.exe and see the output.
- We have successfully executed C#(C sharp) code without visual studio and with .NET Framework only
Please post your comments and feedback.