0

I am used to write code in VS 2008 < . However now I had to start using Notepad++, and I can't get to run even the HelloWorld program. I followed the steps based in this tutorial: http://www.mastercsharp.com/Article/89/writing-your-first-c-program-hello-world-net-v1-1- I have .NET SDK 2.0 installed, but I still can't get the code running. Basically when I try to execute the file from CMD Propmpt I get a message "HelloWorld" is not recognized as an internal or external command, operable program or batch file. Is there anything else that should be installed? I have everything installed to be able to run the code, but I still can't get it to run. Any help will be apreciated. Thank you!

Farkiba
  • 366
  • 1
  • 5
  • 17
  • That means there is no HelloWorld exe in your current dir or dirs that are on PATH – David Goshadze Feb 22 '13 at 11:39
  • Also http://stackoverflow.com/questions/861384/is-it-possible-to-install-c-sharp-compiler-w-o-visual-studio – Fionnuala Feb 22 '13 at 12:12
  • Well my problem was more that the code was not running, and all the solutions I looked up didn't work. Joey gave the answer I was looking for. Anyways thanks for your time :) – Farkiba Feb 22 '13 at 12:15

3 Answers3

2

Write your program in Notepad++ (or any other text editor). Then on the console use

C:\Windows\Microsoft.NET\Framework\v2.0.50727\csc.exe HelloWorld.cs

to compile it. Afterwards you can run the generated executable.

Joey
  • 344,408
  • 85
  • 689
  • 683
  • It seems to work, the only problem is that when I run the generated exe it exits really fast so I don't know if it runs it correct or not. Do you have any solution for this? – Farkiba Feb 22 '13 at 11:45
  • 1
    Put Console.ReadLine() at the end of your code to make it wait for the user to press Return. – Matthew Watson Feb 22 '13 at 11:49
  • 1
    I thought you're trying from the console anyway in which case the window should not disappear after your program exists. – Joey Feb 22 '13 at 12:34
1

You can't run HelloWorld.cs, you need to compile it into an executable. Use csc for that.

Or just install Visual Studio Express, it's free.

CodeCaster
  • 147,647
  • 23
  • 218
  • 272
-1

You can install CS-Script plugin for Notepad++. The plugin allows execution of the C# code (scripts) directly from Notepad++, without the need for any infrastructure (e.g. project file). It also offers convenient launching of the C# scripts with the system CLR Debugger (e.g. VS) attached.

Alex78191
  • 2,383
  • 2
  • 17
  • 24