2012-11-23 34 views
0

在一个项目中,我能够毫无问题地使用ColumnAttribute。使用ColumnAttribute进行引用不准确

在另一个,不是。我有以下的类在测试项目:导致

Ambigous reference: 
System.ComponentModel.DataAnnotations.Schema.ColumnAttribute 
System.ComponentModel.DataAnnotations.Schema.ColumnAttribute 
match 

我有以下引用添加到测试项目

class TestClass_x 
{ 
    [Key, Column(Order = 0)] 
    public int i { get; set; } 

    [Key, Column(Order = 1)] 
    public string i2 { get; set; } 

    public string str { get; set; } 
} 

  • 的EntityFramework(V 4.4.0.0)
  • 项目来测试
  • 另一个项目来测试
  • 第三个项目,以测试
  • Microsoft.VisualStudio.Quality.Tools.UnitTestFramework(ⅴ10.0.0.0)
  • PresentationFramework(V 4.0.0.0)
  • 系统(ⅴ4.0.0.0)
  • 系统。 ComponentModel.DataAnnotations(v 4.0.0.0)

回答

2

您是否使用.NET 4.5?在这种情况下,您将在System.ComponentModel.DataAnnotations.dll和EntityFramework.dll中都有ColumnAttribute。该解决方案应该将EntityFramework升级到5.0,因为4.4版仅适用于.NET 4.0。

相关问题