ASP.net page gets error on import statement, but I do have the reference in place? ASP.net page gets error on import statement, but I do have the reference in place? asp.net asp.net

ASP.net page gets error on import statement, but I do have the reference in place?


As miensol suggested, try putting this in your Web.config file:

<compilation debug="true" targetFramework="4.0">  <assemblies>    <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />  </assemblies></compilation>


The alternative to fiddling with the compilation.assemblies configuration is simply to mark the System.Data.Entity assembly as "Copy Local" in your solution.

This works due to the root-level web.config containing a wildcard add element, which causes all assemblies in your "private assembly cache" to be used during page compilation. From MSDN:

The value of the add element is an assembly name, not a DLL path. ASP.NET looks up the assembly name to find its physical DLL location. Optionally, you can specify the asterisk (*) wildcard character to add every assembly within the private assembly cache for the application, which is located either in the \bin subdirectory of an application or in the.NET Framework installation directory (%systemroot%\Microsoft.NET\Framework\version).


Monish, the App.config file serves about the same purpose as the Web.config file, and adding an assembly is done the same way as it is done for a Web.config file.

<configuration>    <compilation debug="true">        <assemblies>             <add assembly="myassembly, Version=1.0.0.0, Culture=neutral,PublicKeyToken=9999999999999"/>         </assemblies>     </compilation></configuration>