title: .NET 4.0 DataAnnotations GAC/EntityFramework conflict
body: <p>I'm trying to build an ASP.NET web site for Microsoft .NET 4.0 using Entity Framework 6. The website is explicitly targetting .NET 4.0 in <code>web.config</code>:</p>
  
  <p><code>&lt;compilation debug="true" targetFramework="4.0"&gt;</code></p>
  
  <p>, IIS Express' application pool in <code>applicationhost.config</code> also targets .NET 4.0:</p>
  
  <p><code>&lt;add name="Clr4ClassicAppPool" managedRuntimeVersion="v4.0" managedPipelineMode="Classic" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" /&gt;</code></p>
  
  <p>When the site is launched, a number of <code>CS0433</code> compiler errors is shown, ones like below:</p>
  
  <p><code>error CS0433: The type "System.ComponentModel.DataAnnotations.Schema.TableAttribute" exists in both "c:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.ComponentModel.DataAnnotations\v4.0_4.0.0.0__31bf3856ad364e35\System.ComponentModel.DataAnnotations.dll" and "c:\Users\%username%\AppData\Local\Temp\Temporary ASP.NET Files\vs\e798ee36\2b3f5a24\assembly\dl3\fd34a92a\0052703a_0990d101\EntityFramework.DLL"</code></p>
  
  <p>As far as I remember, there should be no <code>System.ComponentModel.DataAnnotations</code> assembly in .NET 4.0, or at the very least it shouldn't contain classes like <code>TableAttribute</code>, <code>KeyAttribute</code> etc. The only lead I have is the bottom line of error page, which says</p>
  
  <pre><code>Microsoft .NET Framework, version:4.0.30319; ASP.NET, version:4.6.1055.0
  </code></pre>
  
  <p>however, I don't know how to change specifically ASP.NET version for a website (of course, if that's the problem's source).</p>