Cannot add System.Linq link to website

I cannot understand why I cannot add a link to the .net namespace System.Linq . I used aspnet_regiis to check if the latest version of asp.net is installed:

  C:\Windows\Microsoft.NET\Framework64\v4.0.30319>aspnet_regiis -lv 2.0.50727.0 C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll 4.0.30319.0 C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll 4.0.30319.0 C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll 

I also tried adding a link to System.Core , but still I cannot reference the System.Linq dll.

Also in my web.config under

  <assemblies> <add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> </assemblies> 

as mentioned above, before the links to System.Core and System.Data.Linq Exist in my website application: in the section “Properties page” → links I could clearly see exsiting refrences, I added them again just in case, and that’s all I can’t use System.Linq or System.Linq.Data NameSpaces.

Any ideas how I could reference the System.Linq DLL would be appreciated.

+4
source share
5 answers

Make sure your project has version 3.0 or higher.

Right click on your project and then click on the link.

and maybe you are looking for this: System.Data.Linq

Check here:

System.Linq Space

System.Data.Linq Namespace

Best wishes

+9
source

System.Core is the dll that the System.Linq namespace is in. As long as you have a link to System.Core in your project, you should be able to do

 using System.Linq; 

in any source file in which you want to use Linq methods.

Check in References in Solution Explorer. If System.Core does not exist, then:

  • Right click link
  • Click "Add Link ..."
  • Select System.Core from the .Net tab.
+11
source

Some time has passed since the question, but if someone is stuck, this solution may seem strange, but for me it has changed: change the target infrastructure from 4.0 to 3.5, rebuild it, and then change to 4.0 and restore again.

+3
source

I had a similar problem. Some of the links that I had in my project did not seem to be resolved when I added, for example, the use of System.Linq to my project, despite the fact that all the necessary namespaces were specified.

This resolved when I removed only "read only" from the properties of the web.config file and rebuilt the project.

0
source

Do not forget to do both:

1 Manually refer to System.Core in the project file if the VS Studio link that links to it causes an error

2 Add this line to web.config if it does not already exist:

 <add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> 
0
source

Source: https://habr.com/ru/post/1385818/


All Articles