Console Application

G

Guest

I have not messed around too much with Console applications, but I started to
build a "project" which is just a place holder for a number of misc "batch"
utilities that I run.

I created the first one and all was right with the world.

When I created my second one and added it to this same project, when I set
this class as the "default" application, then I start getting erront messages
about multiple entry points into the application. Do I have to build a
seperate project for each of thes little utilities? My thought process was
that I would bring up the project and set the one that I wanted to run and
then run it. Do I have to build some sort of Driver class which will be the
single point of entry and then set which one I want to run within it? Is
this the way that I should handle this? Or should I be creating seperate
projects for each of thise little utility applications?

Thanks in advance for you assistance!!!
 
J

Joep

Why not branch on args? You start one app passing it what it should do and
then run the relevant function.
 
A

Azhagan

Hi Jim,

Its perfectly okay to have several classes all having their own entry
points. Just make sure which one you want your project to start up with.
If you are using VS.net IDE, use project properties and set the startup
object to the one you want to use. If you are using your command line
compiler, use the /m or /main with the type name.

HTH,
-Azhagan
 
G

Guest

I had tried this (prior to event creating the question)...setiint up the
second class as the "start Project" in visual studio .net and this is when I
gave me the error of multiple entry points.

SO I appaerntly do not know how to do this...but I think I can set up a
driver program and then just go in and adjust some parm in that program to
run the desire program. I had hoped, that I could, as you have suggested,
that I set the project property to the class that I wanted to execute.

So I am still missing something on this subject....
 
A

Azhagan

I am sorry I thought he was using the program to decide which batch he
wants to use and use the application to execute that set of batch processes
alone.

An alternative would be to use the configuration files (or if its simple
enough, as you have mentioned, use arguments while calling in the app).
 
A

Azhagan

If you have two classes that does some batch processes, my suggestion
will work if you decided to use which one ahead of time [before compiling]
because after compiling, you will not be able to run methods in the other
class.

If its simple enough, you can use the option that Joep suggested, like
using arguments to your application. A better option would be to use xml
config files [like app.exe.config] that you can read from within your
application and decide which set of batch files to run. You can add
attributes for start and end timestamps and you could schedule your app
using windows scheduler. Let me know if you need any help with creating
configuration files or anything else.
 
N

Nick Malik

Hi Jim,

In the past when you did this correctly, you probably had added another
project to the solution and you had set up the alternate project as a
starting point.

I don't see why you shouldn't create seperate projects for each one of your
utilities. If you plan to call them from the command line, and you put it
all in one project, you will have one command. This is a plus and a minus.
Depends on you.

Personally, I'd find it easier just to have one project per utility.
--- Nick
 

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