Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do you need to include parent dlls in child asp.net projects?

I have a newly created asp.net MVC 2.0 application that is in a completely separate solution from an existing asp.net webforms application.

Because I didn't want the user to have to log in again, I deployed the MVC application in the same site as the existing Webforms app - everything works great.

One thing has me completely perplexed though, the Webforms application uses a Third Party DLL that has nothing to do with my MVC application, yet I can't use the MVC application without including that DLL in the MVC \bin directory. Why is this required? It's not part of that application? It's even causing me issues now so I'm even more curious...

Why is this dependency to the DLL being required in my MVC application?

like image 979
Mark Kadlec Avatar asked Jul 23 '10 17:07

Mark Kadlec


1 Answers

The reason is because your parent application probably sets that in web.config in the modules or handlers section, and the IIS configuration system in IIS 7+ uses a distributed/hierarchical config system supporting web.config files.

In this case the child application web.config inherits all the settings from the parent web.config. Unfortunately ASP.NET uses the /bin directory only per-application and it has to be included in the root directory, so that means that since you probably are deploying the DLL in the /bin directory of the parent app, the child app does not know anything about it.

You could modify the parent's web.config to use a location tag and set the inheritInChildApplications so that you stop it from inheriting into the child app: http://forums.iis.net/t/994377.aspx

like image 146
Carlos Aguilar Mares Avatar answered Nov 15 '22 05:11

Carlos Aguilar Mares