While deploying a new application for our our product Communifire as a child application of exisiting site we were getting:
"Could not load file or assembly 'assembly name' or one of its dependencies. The system cannot find the file specified."
The reason why we were getting this error because the child site was taking the parent's site web.config site into its consideration. This behaviour was as per design of .net i.e the settings inside the parent web.config will cascade downwards and all other config files will inherit those settings. If the child site have the settings of their own they will override the parent's one.
The solution was to wrap the sections which we don 't want to inherit in child with this:
<locationpath="." inheritInChildApplications="false"><system.web> ...</system.web></location>
We added multiple segments of "<locationpath="." inheritInChildApplications="false">" to wrap various segments of parent's web.config in order to fix the issue.