C# Command Line Compiler

Hello all,

I've started playing around with C# and have had a bit of a look at C# visual studio express 2008, but I find my laptop doesn't run it very well as it is old and tired. So I thought I might try compiling with cmd.
I eventually managed to get it to recognise csc, but now when I type for example "csc HelloApp.cs" it displays errors cs2001 and cs2008, I have added the path to the folder containing my .cs files to the path variable under system variables in my computer properties, but it cant seem to find it.

 What am I doing wrong? Any help or suggestions much appreciated
LVL 23
Kelvin SparksAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cs2001 means: your cs-file can not be found by the compiler (csc.exe)
for cs2008 you might find help here:
Kelvin SparksAuthor Commented:
Sorted it out now, thanks.
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

here is running sample
complied to an exe.

Save the attached code to main.cs in folder

go to the command line (cmd)
navigate to the folder
(cd C:\CSC_compile)

and type:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc.exe /target:exe  main.cs

This will generate a main.exe

using System;

namespace TEST
    class Program
        static void Main(string[] args)
            Console.WriteLine("Hello World");

Open in new window

you are welcome :)
Altin BardhiSoftware EngineerCommented:
Visual studio should have its own command line. Anyway if you have added the full path under 'environment variables' -> path this should work.

Also try to change the cmd path by typing: cd>(change directory) C:/path to the folder/

First though check if the 'cmd line' of your VS is working properly as you could have some instalation problem.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.