简体   繁体   中英

MVC Asp.Net with Onion Architecture Not publishing Library Projects Dlls.

I have a Solution that contains a

  1. UI Appliction -> contains UI & References Core Proj
  2. Core Project -> contains Domain Models and References Nothing
  3. Infastructure -> Contains Unity Bootstrapper Proj and DAL Proj. Bootstrapper -> contains Automapper and Unity DI config. and references (UI, Core, and DAL)
    DAL -> contains

Everything works builds and works locally but when I publish with Visual Studio, it doesn't bring the DLL's for Bootstrapper or DAL. From my understanding it is because there is no reference between UI and DAL Or UI and Bootstrapper. Thats because the DAL references Core and the Bootstrapper References Everything. How do I get visual studio to include those in my published files?

Normally, you UI project must necessarily contain a reference to the Infrastructure project, otherwise how would you be able to bootstrap Unity at Application_startup without triggering compiler errors?

My experience is that the entry point of the application always contains a reference to pretty much all projects because of such practical requirements. I would therefore suggest adding this reference to fix the deployment issue.

The important point of the onion architecture is to keep the core dependency-free like you have done, and to keep services (domain services and infrastructure services alike) independent from each other. All of this is achieved through a judicious use of Dependency Injection. The Onion Architecture is not some sort of religion preventing you from adding references in the entry point.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM