CS0246 C#类型或名称空间名称';ForeignKeyAttribute';找不到(是否缺少using指令或程序集引用?)

CS0246 C#类型或名称空间名称';ForeignKeyAttribute';找不到(是否缺少using指令或程序集引用?),c#,android,entity-framework,azure,code-first,C#,Android,Entity Framework,Azure,Code First,我正在学习使用实体框架代码优先创建数据库 通过Azure移动应用程序服务 但我有个错误,看起来 我已经使用了System.ComponentModel.DataAnnotations.Schema 但它似乎不起作用 我怎样才能解决这个问题 ===================================================== 最后,我解决了这个问题!! System.ComponentModel.DataAnnotations是ForeignKey的命名空间,也是必需的 S

我正在学习使用实体框架代码优先创建数据库 通过Azure移动应用程序服务

但我有个错误,看起来

我已经使用了System.ComponentModel.DataAnnotations.Schema 但它似乎不起作用

我怎样才能解决这个问题

=====================================================

最后,我解决了这个问题!!

System.ComponentModel.DataAnnotations是ForeignKey的命名空间,也是必需的


System.ComponentModel.DataAnnotations.Schema更具体。例如,如果要将字段映射到特定的列名,或将实体映射到表名。

要将ef的哪个版本作为目标?EntityFramework.dll,运行时版本v4.0.30319:“(嗯,什么版本的.NET?我的实体框架是6.0。如何查看当前使用项目的.NET版本?实际上我可以在其他项目中使用数据批注,只是不知道为什么它在Azure连接项目中不起作用。:”(
CS0246 C# The type or namespace name 'ForeignKeyAttribute' 
could not be found (are you missing a using directive or an assembly reference?)