System.ComponentModel.DataAnnotations.Schema未找到未找到、ComponentModel、System、Schema

2023-09-04 08:24:59 作者:ン陌离つ

我遇到了一个问题,在Visual Studio 2012,涉及到System.ComponentModel.DataAnnotations.Schema命名空间。它告诉我,ForeignKeyAttribute不能得到解决,在过去的解决办法是添加using语句被注释掉如下。 VS2012无法解析架构命名空间VS2010能。在这将是导致此问题的最新的.Net版本有什么改变?如果是这样,我该如何解决它们?

I am running into an issue in Visual Studio 2012 that involves the System.ComponentModel.DataAnnotations.Schema namespace. It tells me that the ForeignKeyAttribute cannot be resolved, the solution in the past was to add the using statement that is commented out below. VS2012 can't resolve the Schema namespace as VS2010 was able to. Has anything changed in recent .Net releases that would be causing this problem? If so, how do I work around them?

推荐答案

你确定你的目标.NET 4.5框架。 ForeignKeyAttribute仅在.NET 4.5可

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