views:

567

answers:

8

In Eclipse, I have a workspace that contains all of my projects. Each project builds and compiles separately. A project does not interact with another project.

How does this relate to Visual Studio and Projects/Solutions there?

+10  A: 

Each VS project builds a single EXE or DLL. The solution is just a collection of related projects.

So VS project:Eclipse project::VS solution:Eclipse workspace.

jodonnell
Am I to understand that people have more than one Eclipse workspace? Maybe that's where I didn't get the relationship. I have one workspace for everything...
Thomas Owens
Some people work on more than one project at a time.
Geoffrey Chetwood
Yes, but the things in my Eclipse workspace are unrelated projects...I mean, they are called projects...Maybe I'm abusing Eclipse.
Thomas Owens
One of the handy features of this too is that if you can set project dependencies within a solution, so that a given project will make sure all of its dependencies are up to date before doing its own compilation.
Dillie-O
Generally, in a project, would you have 1 EXE and many DLLs or is it likely that multiple projects would compile into EXEs that interact with each other?
Thomas Owens
Sounds like it, but I have never used Eclipse.If I am building a company's outfacing website and our main product (say a winforms app or something) I am not going to put them into the same solution, since they are unrelated. I would have to open everything and manage it all together that way.
Geoffrey Chetwood
There are cases when you have multiple EXEs, but I would say it is much more common to have 1 EXE with multiple DLLs.
Geoffrey Chetwood
You can abuse Visual Studio in the same way.
jodonnell
+20  A: 

A VS project is it's own entity. It will build and compile by itself. A Solution is just a way to contain multiple projects. The projects don't necessarily need the other projects to compile (though, they can depend on the other projects).

This just lets you conceptually group projects together into one Big Project. For instance, you can have a separate testing project. It depends on the code from the actual project, and should be kept together with the actual project, but it does not need to be in the same exe/dll.

Howler
You forgot to mention that solutions specify what projects get built for what configuration. You can build different projects in a Release build than in a Test or a Debug build
Mendelt
You can also control build order through a solution, as well as grouping together the deployment project for your application, all under one "umbrella".
J c
+1  A: 

Another way to look at it is, a solution is a container for projects. For most of my work , I create each tier as a project within a solution so my tree looks like:

  • My Web App or Win App
    • Presentation Layer
      • files...
    • Business Layer
      • files...
    • Data Access
      • files

Your mileage may vary

Rob Allen
+1  A: 

@Thomas Owens:

Yes, some (most?) people using Eclipse have more than one workspace. It's what surprised me the most when I first started using Eclipse, so I'm replying here to make this comment more visible.

aib
A: 

A Solution has 0 or many Projects...

Shawn Simon
What good would a solution be with 0 projects?
Geoffrey Chetwood
Dunno, but you can make one.Obviously it rarely has zero projects for very long...
Schnapple
They are great because they always compile.
FlySwat
+1  A: 

The thing that may be throwing you off is the following:

In VS2003, everything had a Project file and a Solution file. If you had a Solution with one Project, you could open the Solution and see the one Project. If you opened the Project, it would try and create a new Solution file to contain the Project. But web projects and Winform projects all had Projects and Solutions.

In VS2005 this changed a bit - by default now, Web projects no longer had Project files. They had received feedback from some web developers that didn't like Project files - their take was that if a file is in the directory, it's part of the app. After VS2005 shipped, they got more feedback from developers who did like the Project file notion, so they patched it back in. This is "Web Site" versus "Web Application" in VS2005 (and I can't remember which is which now).

In addition, in VS2005, if you have a Solution open with only one Project, you won't see in the Solution Explorer that there's even a Solution at all, you'll only see the Project (as if it was not in a Solution). Only after adding the second Project will you see that there's a Solution containing them both.

So basically you were on the right track - Solutions and Projects work the same in Visual Studio as they did in Eclipse, it's just some quirks that make things confusing.

Schnapple
A: 

There are way too many kinds of web projects in Visual Studio 2008. There are Web Site Projects vs. Web Application Projects and they limit you in different ways. It's a good example of Microsoft providing too many choices instead of focusing on one strong solution. Even within the Web site Project option, there are at least 3 different ways to compile your application.

Pete
A: 

I found that not always seeing the solution in the Solution Explorer to be irritating. There is a setting in Options->Projects and Solutions->General called "Always Show Solution" which was handy.

Jeremy Bade