C# classpath equivalent?

  • Thread starter jeremiah johnson
  • Start date
J

jeremiah johnson

Okay this is going to sound really dumb. Skeet, you can poke fun of me
in your own special way if you see fit.

Is there a way to reproduce the CLASSPATH functionality of Java within
C#? Would there ever be a reason to do this? Is there a reason *not*
to do this? There must be, I think, or there would probably be a
CLASSPATH environment variable.

I'm tired of typing /r:... at the command line. I have an IDE, and I
use it, but on some systems there is no IDE and when I want to make a
quick code change and recompile, there's no CLASSPATH to help me.

Why no CLASSPATH environment variable equivalent?
 
J

Jon Skeet [C# MVP]

jeremiah johnson said:
Is there a way to reproduce the CLASSPATH functionality of Java within
C#? Would there ever be a reason to do this? Is there a reason *not*
to do this? There must be, I think, or there would probably be a
CLASSPATH environment variable.

I'm tired of typing /r:... at the command line. I have an IDE, and I
use it, but on some systems there is no IDE and when I want to make a
quick code change and recompile, there's no CLASSPATH to help me.

Why no CLASSPATH environment variable equivalent?

One thing you can do is to use a custom response file if you find
yourself using the same references frequently. An example (and the one
used by default) is in the .NET framework directory - csc.rsp. You can
specify one on the command line by doing

csc @foo.rsp X.cs Y.cs etc

I don't know of any environment variables which do the same, but they
may be there.

Interestingly, these days I think Java developers tend to try to avoid
using the CLASSPATH environment variable, preferring to explicitly
specify the jars/paths on the command line. There are advantages and
disadvantages of both ways, however.
 
J

jeremiah johnson

Jon said:
One thing you can do is to use a custom response file if you find
yourself using the same references frequently. An example (and the one
used by default) is in the .NET framework directory - csc.rsp. You can
specify one on the command line by doing

csc @foo.rsp X.cs Y.cs etc

I don't know of any environment variables which do the same, but they
may be there.

Interestingly, these days I think Java developers tend to try to avoid
using the CLASSPATH environment variable, preferring to explicitly
specify the jars/paths on the command line. There are advantages and
disadvantages of both ways, however.

I didn't know about response files. Thanks a ton, Jon. This will save
me a lot of typing. :)
 
V

Vijay

I have never done at command line... but just a thought, can't you keep a
batch file and just run it when you have no IDE?? I maybe way of line
here...

VJ
 

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