Getting Started.

P

Peter Morris

Hi, I'm just beginning to learn C# programming. I've got myself a copy
of Borland C# Builder and a 'Teach Yourself C# in 21 days' manual.

The examples in the book tell me how to build console applications, and
compile and run them from the command line. I can run them from
C#Builder itself, but a lot in the book depends on compiling and
running the programs from the command line. How do I do this?

If I create a class HelloWorld in file helloworld.cs in project
Hello.bdsproj, how do I compile it? The book says : csc HelloWorld.cs
but this just gives the error message "csc is not recognised as an internal
or external command, operable program or batch file"

What do I do?


--
_______________________
/_____________________(_)
| _____________________ email to
| | |__________________(_) Peter_Morris_1 at
| |/____________________ btinternet dot com
|_____________________(_)
 
E

Eric Eggermann

Peter Morris said:
Hi, I'm just beginning to learn C# programming. I've got myself a copy
of Borland C# Builder and a 'Teach Yourself C# in 21 days' manual.

The examples in the book tell me how to build console applications, and
compile and run them from the command line. I can run them from
C#Builder itself, but a lot in the book depends on compiling and
running the programs from the command line. How do I do this?

If I create a class HelloWorld in file helloworld.cs in project
Hello.bdsproj, how do I compile it? The book says : csc HelloWorld.cs
but this just gives the error message "csc is not recognised as an internal
or external command, operable program or batch file"

What do I do?

Maybe you need to change the current directory to wherever your copy of csc
is.
ChDir [path to folder containg csc]
Then try to compile again.

HTH,
Eric
 
M

Morten Wennevik

You need to add a path to your framework directory containing all the
executables
typically c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322 (or v1.0.3705 if
you only have the old framework)
that is where csc.exe should be.

To add the path, right click on My Computer, choose properties->advanced
and click the button saying "Environment variables" in the System
variables window, scroll down and locate "Path" and click edit.
Add the end of that line (DO NOT REMOVE ANYTHING or other things may fail
to work properly) add

;c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322

the semicolon separates each path and after the semicolon you add your own
path.
When you try to run a program, windows will first try to find it in the
current directory, and if it doesn't find it there it will search all
paths listed in the path statement.
 
B

Bob Powell [MVP]

You need to run the "sdkvars.bat" batch file that's in the SDK\bin
directory.

For command line compiles I created a batch file in the root directory that
calls this one so that I can simply type "env" at the c prompt to get all
the SDK paths set up. Here's my env.bat file. Note that you may have to
change the path to match the location of your own .NET SDK.

call "C:\Program Files\Microsoft Visual Studio .NET
2003\SDK\v1.1\Bin\sdkvars.bat"


--
Bob Powell [MVP]
C#, System.Drawing

The November edition of Well Formed is now available.
Learn how to create Shell Extensions in managed code.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top