System.ComponentModel.DataAnnotations.Schema not found

家住魔仙堡 提交于 2019-12-05 01:17:19

Are you sure you are targeting .NET 4.5 Framework. ForeignKeyAttribute is only available in .NET 4.5

I reinstalled the Entity Framework and it works!

Your code and the System.ComponentModel.DataAnnotations.Schema namespace are correct.

So check your references. This one should be in Assembly System.ComponentModel.DataAnnotations.dll, v4.0.0.0

Did you upgrade the project from Fx 4?

You can fix the version with NuGet.

You can find the assembly in the References section of the project. Click on the framework tab and search for the Assembly. This is a default assembly from the Microsoft .Net framework.

khaleel

Delete the already added reference System.ComponentModel.DataAnnotations and include it again.

If it still doesn't work, uninstall entity framework completely and reinstall it via nuget manager.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!