您的位置:首页 > 其它

CS0234: The type or namespace name 'Linq' does not exist in the namespace 'System.Data'

2017-10-02 16:31 921 查看
转载 Posted on October 26, 2010 by
Jed

If you receive an error in your .aspx page that looks somethinglike:





Compilation Error

Description: An error occurred during the compilation of aresource required to service this request. Please review thefollowing specific error details and modify your source codeappropriately.

Compiler Error Message: CS0234: The type or namespace name‘Linq’ does not exist in the namespace ‘System.Data’ (are youmissing an assembly reference?)

You may be able to resolve the error simply by adding anassembly reference to your Web.config file.

In our example error you will notice that the compiler is havingproblems finding the “Linq” namespace within the “System.Data”namespace. It is strange to me that the Linq namespace cannot befound since the reference has been added to the web applications“References”.
Regardless, to explicitly tell the compiler toinclude the Linq namespace add the following attribute to theWeb.config file.

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


By adding the Linq assembly to the system.web configuration’sassemblies, the error noted at the top of this post wasresolved.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐