I have a solution composed by 3 projects.
- one for Entity framework that contains my edmx diagram
- one for my core business
- and one for my web app
When I publish my code on a server or hosting service I get this runtime error:
{"Could not load file or assembly 'EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.":"EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"}
I get this error because my entity framework assemblies is not published. The entity framework dll file is missing on my server. I know why. I didn't referenced it in my web app project because this assemblies is not required in this project. The assembly is referenced in my two other projects.
I can easily fix my issue by adding the entity framework reference in my web app. Can I do that? yes but is it good programming to add a reference to an assembly that is not directly used by the project? What can I do?
More information
- one for Entity framework: reference Entity Framework
- one for my core business: reference Entity Framework because I manipulate my entities here
- and one for my web app: web site that act like facade between the UI and the core business. I don't reference or use Entity Framework here.
I don't have any compilation error> I only have a runtime error because my entity framework is not published.
In Windows Application in this case I don't reference my dll in the project but I copy it with a post build action. I don't know what to do in the case of a web app I need to publish or deploy.