I have a 3-tier .NET 2.0 app. The presentation layer references the middle tier. The middle tier references the database layer. For some reason, when I compile, the dll's for the data layer appear in the bin of the presentation layer. How do I stop this?
The only way to stop this is to make one or more of your tiers a service-layer (or something similar) to physically separate your tiers.
Since your separate tiers were compiled against each other the assemblies need to be there for the entire application to function properly. How do you envision the application working without all the assemblies?
It is OK to be copied because there are known as Dependencies. Your Middle tier depends on DataAccess and UI on Middle tier. You have to keep track only not to reference data access from UI.
Normally I do physical layer application as following:
- UI
- Presenter
- BusinessLogic
- DataAccess
- Entity
But I'm changing my view on this organization. As I have done lot of projects and some of them demands maintenance and improvements. I start to think that this organization is too monolithic. Some authors like Ted Faison, Tomas Erl, Robert C. Martin, Andy Aunt says that this hierarchal approach is kind of naive.
Anyway... Put your logic in separated projects and build them as distincted assemblies. Make hierarchal references and you'll have what you want.