I have a solution with an ASP.NET MVC 3 project, and a class library project. I created a reference to the class library, "Commands", in the web project, which is resolving; copy-local is also set to true and Commands.dll is being copied into the web project's bin directory.
When I try to add a strongly-typed view, selecting a class from Commands as the model, I receive a "Could not load file or assembly" error for the Commands assembly.
I've tried removing and re-adding the reference, cleaning and rebuilding the solution, etc. but still have the problem.
Something else odd about this is that when I click "Add view" in the controller to get to the add view dialog, the model in the referenced assembly is available in the "Model class:" drop-down.
Try using the Fully qualified name for the model class in your view.
Ex : @model YourClassLibraryNameSpace.YourClassname
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.