I have a solution with 2 projects
- #1 is C# Class Library, where I have my EF model defined (3.5 sp1) and some public methods.
- #2 is a VB winforms app.
In the winforms app, I have referenced the C# library and added the connection string for the EF model.
The problem I am having is that I have a form where the user selected a .txt file to import. On the VB side, I create a byte() from the file, then pass it to a public method cleverly called Process. In Process(), everything runs smoothly until I instantiate the EF model.
using (WorkersCompImportEntities context = new WorkersCompImportEntities()) { ....
Where I receive this error:
Could not load file or assembly 'System.Drawing, Version=1.0.3300.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
The system cannot find the file specified.
I successfully use the EF class in an MVC 3 app, and I need to be able to use the same class library for the VS 2008 winforms app, too.
The VB app has an existing reference to System.Drawing Version 2.0.
Do I need to re-work something major? I am at an impasse.
It would seem you’re using
res://*for the EF model source and one of the assemblies you reference still references the oldSystem.Drawingassembly from .net 1.You should specify exactly which assemblies, files or directories EF should scan for models so that EF doesn’t start trying to recurse through every assembly your project happens to reference, especially when you’re using 3rd party controls that may conditionally use assemblies that are not always available.
See, Model and Mapping File Locations for how to specify where the mappings come from.
For a discussion of the problem see: