Reputation: 2828
I have split my mvc4 application in two projects. One main and one Model which is referenced in main project. However when I try to create a CRUD controller I get an exception in ControllerWithContext.tt(-1,-1)
,
FileNotFoundException: Could not load file or assebmly .... or one of its dependencies. The system cannot find the file specified.
What is wrong?
Upvotes: 0
Views: 328
Reputation: 18977
I think the problem is from the EF connection string. Usually, when you want to use an embedded resource, you should set the Metadata
in the EF ConStr like the following:
Metadata=res://<assemblyFullName>/<resourceName>.
You also can use the *
wildcard instead of <assemblyFullName>
like the following:
Metadata=res://*/model.csdl| ...
Where model
is the name of youe .EDMX file. It causes the EF to search the following locations for the file at runtime:
If you are trying to get a model from another project, you should enter the full name of your project in the metadata:
Metadata=res://MyModelPrj/model.csdl | ...
Finally, if your solution contains just a .EDMX file, you can simply use the following:
Metadata=res://*/
Note that this works only if you have only one model in the whole solution. If you have more than one model in your solution, It just cause another error...!
More info is here
Upvotes: 1