Edmx file with Visual Studio 11 Beta .Net 4.5

2020-07-20 08:08发布

问题:

I am having trouble creating a new edmx file using Visual Studio 2011 beta

  • Target framework .Net 4.5
  • Class library project

After adding an empty model I get the error below

Error 6039: warning CS1701: Assuming assembly reference 'System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' matches 'System.Data.Entity, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089', you may need to supply runtime policy \fjwflppr.0.cs(465,29) : error CS1061: 'System.Data.Metadata.Edm.EdmFunction' does not contain a definition for 'IsComposableAttribute' and no extension method 'IsComposableAttribute' accepting a first argument of type 'System.Data.Metadata.Edm.EdmFunction' could be found (are you missing a using directive or an assembly reference?)

Method not found: 'Boolean System.Data.Metadata.Edm.EdmFunction.get_IsComposableAttribute()'.

According to msdn EdmFunction.IsComposableAttribute is only supported in .net 4.5 and the project by default references the dll from C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.Entity.dll but the file Properties window in vs is showing 4.0.0.0

I am confused about which version of System.Data.Entity.dll my project should reference to get the edmx designer to work.

回答1:

The issue was because the EF CTP uninstall didn't clean all files, it left a policy file which had binding to the old version "4.2.0.0", so VS will always look for that old version.

details here https://stackoverflow.com/a/9665596/1261784