I created an ASP.NET MVC4 project in VS 2010, then decided I wanted the 4.5 framework so opened the project in VS 2012 and changed the target framework to 4.5.
I got some compile errors which I am fairly sure were caused by a reference to a version of EntityFramework below version 5.
Eg:
Error 2 The type or namespace name 'Table' could not be found (are you missing a using directive or an assembly reference?) c:\users\saad\documents\visual studio 2012\Projects\MvcApplication1\MvcApplication1\Models\AccountModels.cs 21 6 MvcApplication1
Here are the entries currently in my Web.config file:
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
and ...
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
I had no luck changing the EntityFramework reference to a higher version as it did not appear in the framework list.
Following some advice given to somebody with a similar problem, I tried to use the Package Manager Console to solve the problem. You can see the mess I've got into with it below.
Does anyone have any idea how to resolve this problem?
I do need version 5 for the work I am doing.
PM> Uninstall-Package entityframework Successfully removed 'EntityFramework 5.0.0' from PersonalityTest_002. The directory is not empty.
Successfully uninstalled 'EntityFramework 5.0.0'.
PM> Install-Package entityframework Install-Package : The remote name could not be resolved: 'nuget.org' At line:1 char:16 + Install-Package <<<< entityframework + CategoryInfo : NotSpecified: (:) [Install-Package], WebException + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand PM> Install-Package EntityFramework 'EntityFramework 5.0.0' already installed. The directory is not empty.
Successfully uninstalled 'EntityFramework 5.0.0'. Install-Package : Failed to add reference to 'EntityFramework'. At line:1 char:16 + Install-Package <<<< EntityFramework + CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand PM> Install-Package entityframework 'EntityFramework 5.0.0' already installed. The directory is not empty.
Successfully uninstalled 'EntityFramework 5.0.0'. Install-Package : Failed to add reference to 'EntityFramework'. At line:1 char:16 + Install-Package <<<< entityframework + CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand PM> Install-Package EntityFramework 'EntityFramework 5.0.0' already installed. The directory is not empty.
Successfully uninstalled 'EntityFramework 5.0.0'. Install-Package : Failed to add reference to 'EntityFramework'. At line:1 char:16 + Install-Package <<<< EntityFramework + CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand PM> Uninstall-Package EntityFramework -Force Uninstall-Package : Unable to find package 'EntityFramework'. At line:1 char:19 + Uninstall-Package <<<< EntityFramework -Force + CategoryInfo : NotSpecified: (:) [Uninstall-Package], InvalidOperationException + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.UninstallPackageCommand PM> Install-Package EntityFramework 'EntityFramework 5.0.0' already installed. The directory is not empty.
Successfully uninstalled 'EntityFramework 5.0.0'. Install-Package : Failed to add reference to 'EntityFramework'. At line:1 char:16 + Install-Package <<<< EntityFramework + CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand PM>