views:

127

answers:

3

Do you have one solution with the web application project, class libraries, database project and tests? Or, do you segment it into multiple solutions? Why?

I'm asking because we're trying to streamline this scenario for Visual Studio 2010 and I'd like to get input from the community on how you'd prefer to work.

+3  A: 

I tend (but not always) to have one solution per job, but I import existings projects from other solutions, such as my WebControlLibrary where I keep common user controls and classes, etc.

My actual solution for the job I then tend to break down into the Web Application, Business Logic Layer, Data Access Layer and Entity Layer, i.e.:

Solution
...MyCompany.WebControlLibrary
...Project
...Project.BusinessLogic
...Project.DataAccess
...Project.Entities
...Project.Scripts
...Project.Testing
...Project.Deployment

If a project requires something such as a mobile device, I'll always put that in a new solution, but it may perhaps share some projects of the current solution, i.e.

MobileSolution
...MobileProject
...Project.Entities
...MobileProject.BusinessLogic

The more 'stuff' you have combined, the slower Visual Studios becomes at building. You can obviously stop certain projects building by default, but that's when you have to start creating your own build configurations. If you are going to be creating large applications, I'd suggest breaking down into multiple solutions. I find it much easier to flick between solutions that to keep changing build configurations.

Another option is that when you build your projects you can reference their DLLs. I prefer to import said projects into my solution as you never have to worry about referencing the creating build configuration i.e. selecting the DLL from the Debug or Release folder.

GenericTypeTea
Thanks for your reply. Could you elaborate a bit on Project.Deployment? What type of project is that? Does it automate your overall deployment? Does it target one or multiple target environments?
Jim Lamb
It was just an example of a project type. It could be a setup project, a web deployment project, etc. I tend to keep these in the solution but remove them from the build order.
GenericTypeTea
When you remove them from the build order, do you build them in a separate configuration (one that you don't generally use for local desktop builds)?
Jim Lamb
Normally I just remove them from all configurations, and then create a new deployment configuration with everything enabled.
GenericTypeTea
When you're doing your build configuration are you using a script like nAnt or are you doing something different?
Chris
I just configure it through Visual Studios. We use CruiseControl.Net in the background on the repository server that creates version controlled builds in separate directories on the build server.
GenericTypeTea
A: 

Stand alone libraries can be their own solutions. References for those libraries can be made into the project that you're working with. Related items like the web application, the test setups, and specific libraries such as data access or business rules can be setup as projects within one solution. It really all comes down to how much you want to break things out for resuability.

Chris
How about your database components (create scripts, s-procs, etc.)? Do you use a database project for those, or do you manage them in some other way?
Jim Lamb
I've done it in two ways. They have been included as a 'folder' inside of a solution and updated on a wiki for the team to see or they have been managed through a seperate repository within a source control soltution like SVN. I have also seen it a few times included as a project within VS, and edited within Visual Studio.
Chris
A: 

This depends a little on the job the project performs.

For ease of use it's simple to have a solution that just contains all the projects required. If it's a large solution this can hamper you later on when the IDE starts to get slow and build times rocket through the roof.

Let's say one of the projects is a library used by your company to take card payments and interface with 3d secure. You present you're own GUI page to take the details etc.

If you had numerous sites that all take card payments you would greatly benefit by having this project in a separate solution and referencing the compiled dll. Any changes you require you would need to open up the solution, make the change, build it, go to the solution you're working in and test it. Sounds like a pita and you find it's just simpler to have it all in one big solution. But then if you have this library in every solution and make a generic change to it you need to repeat that change through out.

So you just need to make a decision on wether you're developing a separate project in the same solution or something that might be used elsewhere. If you needed more functionality than the library provides you could implement a partial class in your project and extend the library in that way. Or perhaps a wrapper class will suffice. But then you know you're not affecting the other sites that use this library and you are keeping your solution smaller and more manageable with a smaller memory print during development.

Robert