I've converted an ASP.net MVC 4 project from .NET 4.0 to .NET 4.5 following the technique outlined in this SO answer -- in particular in the vbproj
file I've set TargetFramework
to v4.5
and Prefer32Bit
to false
.
I now get the following error in the Entity Framework model (inherited from the MVC template project)
TableAttribute is ambiguous in the namespace
System.ComponentModel.DataAnnotations.Schema
Using Object Explorer I've seen that TableAttribute
in present in assemblies System.ComponentModel.DataAnnotations.dll
(taken from the reference assemblies) and EntityFramework.dll
(taken from Entity Framework 5 installed from NuGet).
Browsing through similar SO threads I've understood that, since I've done a manual conversion, the reference of EntityFramework.dll
was not updated to point to the (correct) .NET 4.5 assembly.
I removed and re-added the Nuget package and the project compiles -- now TableAttribute
is present only in System.ComponentModel.DataAnnotations.dll
.
if you're using NPM (Nuget Package Manager) then issue the command:
update-package EntityFramework
Rebuild the project if the error still persist and it will be fixed. This is how I got to fix it.
Thanks!
I have same issue and I only removed the entity framework reference from framework 4.0 folder and added again from framework 4.5 folder in packages under solution
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With