I have a Web app project that uses Linq. I am receiving the following error:
The type or namespace name 'Linq' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
in the line:
using System.Data.Linq;
The reference points to the correct file and in other projects everything is fine. the projects builds successfully and gives this error right after that.
If someone has an idea what is happening or some previous experience with such an error - please.
I am testing it on my local machine - I have VS2008 installed - I think it should be ok and besides I have other apps that are working with linq. Do you think I have to install Linq separately?
It is something related with your web.config file I think. I also have a project and trying to get AJAX working. So I have two different web.config files and I make trials with both of them. When I run the application with one of the web.config files
it works. However with the other one it gives the error
"CS0234: The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?) "
I could not figure it out right now but it seems that it is related with some missing entries in the web.config file. If I solve it I will post....
According to another post on the issue at
http://msdn.microsoft.com/en-us/library/system.linq.aspx, they suggest adding a reference to System.Core (v3.5) --in Visual Studio ( "Website" menu | "Add Reference..." | ".NET" tab | Component Name "System.Core". That fixed it for me. Not sure which
is more appropriate...anyone? Thanks, Mike.
I added the "System.Core" reference as suggested on the msdn site. I even had the proper web.config assembly references in place as described within the previous forum posts above, but the error didn't go away until I added a Reference to "System.Data.Linq"
to my project by clicking on the Project's Name in Visual Studio, then "add reference" then "System.Data.Linq" on the .Net tab then the OK button.
joppo
Member
624 Points
153 Posts
The type or namespace name 'Linq' does not exist in the namespace 'System.Data' (are you missing ...
May 22, 2008 10:46 AM|LINK
Hi everybody,
I have a Web app project that uses Linq. I am receiving the following error:
The type or namespace name 'Linq' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
in the line:
using System.Data.Linq;
The reference points to the correct file and in other projects everything is fine. the projects builds successfully and gives this error right after that.
If someone has an idea what is happening or some previous experience with such an error - please.
Thank you in advance.
jeff@zina.co...
All-Star
87677 Points
11637 Posts
Moderator
Re: The type or namespace name 'Linq' does not exist in the namespace 'System.Data' (are you miss...
May 22, 2008 11:18 AM|LINK
Did you install Linq on the server?
Jeff
joppo
Member
624 Points
153 Posts
Re: The type or namespace name 'Linq' does not exist in the namespace 'System.Data' (are you miss...
May 22, 2008 12:02 PM|LINK
I am testing it on my local machine - I have VS2008 installed - I think it should be ok and besides I have other apps that are working with linq. Do you think I have to install Linq separately?
Zhivko
eengin
Member
23 Points
32 Posts
Re: The type or namespace name 'Linq' does not exist in the namespace 'System.Data' (are you miss...
May 25, 2008 06:05 AM|LINK
Joppo
It is something related with your web.config file I think. I also have a project and trying to get AJAX working. So I have two different web.config files and I make trials with both of them. When I run the application with one of the web.config files it works. However with the other one it gives the error
"CS0234: The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?) "
I could not figure it out right now but it seems that it is related with some missing entries in the web.config file. If I solve it I will post....
eengin
Member
23 Points
32 Posts
Re: The type or namespace name 'Linq' does not exist in the namespace 'System.Data' (are you miss...
May 25, 2008 07:21 AM|LINK
I resolved the problem.
I copied the compilation section under the <system.web> tag from the working web.config. That is:
<compilation debug="true">
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies>
</compilation>
Be careful that the crucial lines here are:
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
to resolve the System.Linq.... error. The others are related with my particular application. But I posted them in any case....
After this, another error has occurred. It said:
"'System.Array' does not contain a definition for Contains" ..................
Then I also copied the <system.codedom> tag which is a child tag of <configuration>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="OptionInfer" value="true"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
</compilers>
</system.codedom>
And finally it worked...
deliub
Member
12 Points
1 Post
Re: The type or namespace name 'Linq' does not exist in the namespace 'System.Data' (are you miss...
May 26, 2008 05:30 PM|LINK
Hi,
I hope that you fixed the problem, just in case you did not add this line into web config where other assembly's are
<
add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>melliott@ema...
Member
2 Points
1 Post
Re: The type or namespace name 'Linq' does not exist in the namespace 'System.Data' (are you miss...
Feb 16, 2009 08:09 PM|LINK
According to another post on the issue at http://msdn.microsoft.com/en-us/library/system.linq.aspx, they suggest adding a reference to System.Core (v3.5) --in Visual Studio ( "Website" menu | "Add Reference..." | ".NET" tab | Component Name "System.Core". That fixed it for me. Not sure which is more appropriate...anyone? Thanks, Mike.
LINQ Reference
hasanfq
Member
65 Points
15 Posts
Re: The type or namespace name 'Linq' does not exist in the namespace 'System.Data' (are you miss...
Mar 12, 2009 03:13 AM|LINK
gr9 thanks, this solution worked for me. i was facing error mentioned in subject and adding this line worked.
Thanks!
LINQ Reference
orinwalker
Member
2 Points
1 Post
Re: The type or namespace name 'Linq' does not exist in the namespace 'System.Data' (are you miss...
May 13, 2009 11:56 AM|LINK
Really great solution putting this in the web.config file. Worked like a charm!
Thanks!
freddya26
Member
2 Points
1 Post
Re: The type or namespace name 'Linq' does not exist in the namespace 'System.Data' (are you miss...
May 16, 2009 11:51 AM|LINK
Melliott,
I added the "System.Core" reference as suggested on the msdn site. I even had the proper web.config assembly references in place as described within the previous forum posts above, but the error didn't go away until I added a Reference to "System.Data.Linq" to my project by clicking on the Project's Name in Visual Studio, then "add reference" then "System.Data.Linq" on the .Net tab then the OK button.