views:

252

answers:

1

I'm currently in the process of developing a large application. At the moment, i have one solution (this may change in the fullness of time) with many projects.

I've set up the directory structure as:

\ lib\ (contains shared 3rd party components) build\ build\bin (output directory) build\wwwroot (output directory for web app) config\ ) src\ (contains the folders for the below projects)

On each of the projects, I have set the build location (output directory) to "..\build\bin\" This, as illustrated above, makes the projects build into build\bin, above the src directory. On

Company.Entities References Company.Common This has all the business objects (customer, order, product) etc....

Company.Common Contains classes that format strings, dates, file access etc.... Doesn't contain any references to any other of the Company. libraries.

Company.Data References 3rd party lib (Castle Windsor for example) This contains interfaces like IRepository, ICustomerRepository, IOrderRepository etc.... Has RepositoryFactory class - this has a method called "Get()" which uses Ioc (Castle Windsor) to return the Also contains IoC for resolving the current implementations of these repositories. Castle.config is in the \config\ directory - and included "as a link" in this project. I've set it to always copy to the output directory

Company.Data.LinqToSql References Company.Data This is the current data access library. It's instantiated by IoC

Company.Logic References to Company.Data Business logic layer - has methods like GetProductById(string id) - this in turn calls Repository.Get().GetById(id) - for example

Company.Tests Self explanatory... will make more use of this in the future.

Company.Web References Company.Logic, Company.Entities, Company.Common Web UI layer - this is the main website.

Ok, hopefully that gives you a little background into the current architecture of my projects etc...

Currently, I'm building everything into thie build/bin directory, except for Company.Web, which builds into build/wwwroot (this adds a bin directory in there) I then have a post-build event that copies aspx pages, style sheets, images, js files etc.... from the src/Company.Web location to build/wwwroot I've configured Visual Studio to use IIS for debugging, and set up an iis virtual directory to point to my build/wwwroot folder.

However... Certain required files are not built into the wwwroot/bin directory Such as - Company.Data.LinqToSql - since this isn't referenced by proejcts, but instantiated using IoC

How can I improve my Build process / project structure to help me with my development? I will "thumb up" all sensible suggestions.

+1  A: 

One thing that jumps out is the copying of output files to build/bin. Do you have separate sub-folders for Release and Debug builds? I've worked on a large project that used a similar setup to yours, and we frequently ran into issues where someone switched from one build to the other, but not all of the files were necessarily rebuilt (for one reason or another.) The directory often contained a mixture of files from the two builds.

As for post-build events, I try to avoid them as they tend to be difficult to locate when you need to modify them later. They also prove annoying when you need different behavior on a developer machine vs a build server. Instead, I usually create a .bat file or MSBuild script to handle file copying, zipping, etc.

Otherwise, it sounds like you have a decent structure and process. Throughout the project you may run into issues, confusion, etc. Be sure to make note of these as potential items to change, or to consider on future projects.

Pedro