Good Evening Everyone,
I am a beginner at C#. I have dled VS2008 and i tpyed the Hello World code. Although I am trying to execute the file through the Command Prompt. Can anyone show me how to type the path correctly to execute the file?
-KK
Loading
Pradeep ChandrakerPosted Jun 22, 2011, 9:09 PM
Kennan KelPosted Jun 22, 2011, 6:12 PM
Good Day for now.
-Kk
Sam HobbsPosted Jun 22, 2011, 11:13 AM
In VS, go to "File | New | Project...". That will show a New Prpject form. There is a tree view of templates at the left side. Open the Visual C# node and select Windows. In the middle there will be Console Application; choose that then click on OK. That will create a project that includes a Program.cs file. Add code to theProgram.cs file. Then use "Build | Build Solution". Fix any errors and build again if needed. Then press Ctrl-F5 to execute.
There are many more details to learn about all that and I hope you can find a tutorial or book to help you with it.
VulpesPosted Jun 22, 2011, 4:03 AM
Pradeep ChandrakerPosted Jun 22, 2011, 12:52 AM
if you have hello.exe in "C:\xxx\xxx\documents\visualstudio2008\projects" directory. You may change directory using CD command to "C:\xxx\xxx\documents\visualstudio2008\projects" directory and type "hello", click on enter to execute. Some thing like this:
C:\xxx\xxx\documents\visualstudio2008\projects> Hello
Kennan KelPosted Jun 22, 2011, 12:25 AM
I know this is wrong, but am I close?
Or should i just move my folders?
Pradeep ChandrakerPosted Jun 21, 2011, 11:01 PM
Create "Hello.cs" file from notepad and write below code in the same file.
using System;
namespace TestApp
{
class Hello
{
static void Main(string[] args)
{
Console.WriteLine("Hello...");
Console.ReadKey();
}
}
}
Open Visual Studio command prompt and type this command
csc /out:Hello.exe Hello.cs
It will create Hello.exe on the same folder. Now just type "Hello" on the command prompt, you will get the output. You may also directly click on Hello.exe to execute it.