[MonoDevelop] Understanding Projects and Solutions

Todd Berman tberman@off.net
Thu, 02 Sep 2004 20:53:11 -0400

On Fri, 2004-09-03 at 12:37 +1200, Rob Brown-Bayliss wrote:
> On Tue, 2004-08-24 at 04:44, Alexandre Gomes wrote: 
> > Hi,
> > 
> > What you want to do is a Solution. A Solution can contain none to many 
> > projects. Each project will compile to an Assembly, either .exe or .dll.
> > In your case, you'll create one solution and add 3 executable projects to 
> > it. Them you code wich one and compile each one. When you start to require 
> > to use functions from another executable you add a Reference to the other 
> > executable, and then you can call its namespace/classes.
> > 
> > Just be careful with circular references, you can't add a reference to a 
> > executable/assembly that also references those project as well.
> > 
> > Hope it helps.
> I have just been revisiting this, and it seems overkill.  
> Lets say I have a database, and I am building several executables that
> access this database.  In my solution I make a project for the first
> app, and create classes that access the database.  
> I then create a second project in the solution that also needs to work
> with the database, why cant I just do: using Database; and add a
> reference to the Databse.cs file from the first project?
> Why do I also need to add a reference the the .exe from the first
> project, wont this require more over head when run?  
> I guess I am missing some thing...

Well, .NET works that way. If you want to use the one .cs file you can
either compile it to a dll and reference that, or you can import it into
each project. Note, you will end up with 2 copies of the same file that
you will have to keep in sync.

If your question is why can't monodevelop reference the same file in 2
solutions without requiring it to be a copy, thats different. But as far
as the referencing a single .cs file, thats just now how .net works.