# C# help !



## red_devil (Nov 16, 2007)

i have just begun learning the C#  language  for .NET and i want you to help me out ... 

i want to learn about programming using C# ... can u please tell me how i can do this ?

i dont want to use VC# ..so i've downloaded .NET SDK  and installed it in my D drive.. { my XP is in C } . now how do i run the programs ? i typed out a program in notepad and saved it as a ".cs" file .. and then went to command prompt and typed out csc <filename>.cs and it gave me an error saying could not load file ..

so can anyone please tell me in detail how i can execute a c# program ?


----------



## Zeeshan Quireshi (Nov 16, 2007)

best way is to use the FREE Version of Visual C# n that is Visual C# 2005 Express .

*msdn2.microsoft.com/hi-in/express/aa700756.aspx

IF you still want to run from command line , then check that when youa re in CMD u have switched to the folder in which the <filename>.cs is saved


----------



## red_devil (Nov 16, 2007)

hey i did that ... the file i created was on my desktop and once i entered into the command prompt , i just hit  csc <file.cs> ... but still got the error !

was wondering if there was any environment variable to be set/ edited..

PS: i dont think i would be doing any "actual" programming stuff ... { just some console programs for now... so i think i will stick onto CMD LINE ... }


----------



## [xubz] (Nov 16, 2007)

What error are you getting exactly? something like the line below?

"test1.cs(7,4): error CS0103: The name 'Console' does not exist in the current
        context"

If Yes, type '*using System;*' on the top of your Program (or type System.Console.<whatever> instead of just Console.<whatever>)

Edit: (If the above doesn't work) Try this.

Goto *C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727* (or something similar)

and try csc-ing from there.


----------



## red_devil (Nov 16, 2007)

@ ^^^

it says " 'csc'  is not recognized as an internal or external command .. "


----------



## RCuber (Nov 17, 2007)

use visual studio command prompt for all compilations...


----------



## red_devil (Nov 17, 2007)

@ charan ... how should i do that ?


----------



## RCuber (Nov 17, 2007)

^^^ it must be in the programs> Visual studio .NET  > tools


----------



## a_tif (Nov 18, 2007)

right click *My Computer*
*Advanced -> Environmental variables*
in system variables, select *path*
select *edit*
at end append a  *; (semicolon)*
now enter the *directory* whr u have the executable


----------



## red_devil (Nov 18, 2007)

this one worked perfect... thank u a_tif...


----------



## a_tif (Nov 22, 2007)

n6300 said:
			
		

> this one worked perfect... thank u a_tif...


 
glad to help


same thing works for any other command which is not recognized as an internal or external command


----------

