简体   繁体   English

实体框架错误PublicKeyToken = null'

[英]Entity Framework error PublicKeyToken=null'

我有两个实体Book.cs和Publisher.cs,还有上下文类,我通过控制器(每个人都准备好了,可以)创建Publisher.cs的CRUD,我现在尝试创建BookController,但出现此错误:

Could not load type 'MvcProject.Models.Publisher' from assembly 'MvcProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'

Is the assembly in the GAC or any place the might be overriding the assembly that you think is being loaded? 程序集是否在GAC或可能覆盖您认为正在加载的程序集的任何地方? This is usually the result of an incorrect assembly being loaded, 这通常是由于加载了错误的程序集导致的,

|| ||

If you have one project referencing another project (such as a 'Windows Application' type referencing a 'Class Library') and both have the same Assembly name, you'll get this error. 如果您有一个项目引用了另一个项目(例如,引用了“类库”的“ Windows应用程序”类型)并且都具有相同的程序集名称,则将收到此错误。 You can either strongly name the referenced project or (even better) rename the assembly of the referencing project (under the 'Application' tab of project properties in VS). 您可以使用强名称来命名引用的项目,也可以(甚至更好)重命名引用项目的程序集(在VS中项目属性的“应用程序”选项卡下)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM