Import the System.Query namespace

I am trying to download Linq on my .Net 3.5-enabled web server by adding the following to my .aspx page:

<%@ Import Namespace="System.Query" %>

However, this fails and says that he cannot find the namespace.

The type or name of the Query namespace does not exist in the System namespace

I'm also out of luck:

  • System.Data.Linq
  • System.Linq
  • System.Xml.Linq

I believe .Net 3.5 works because it var hello = "Hello World"seems to work.

Can anyone help?

PS: I just want to clarify that I do not use Visual Studio, I just have a text editor and directly write my code in .aspx files.

+3
source share
6 answers

I have version 2 selected in IIS and I

Well, of course, what's your problem? Select 3.5.

, :

http://www.hanselman.com/blog/HowToSetAnIISApplicationOrAppPoolToUseASPNET35RatherThan20.aspx

+4

web.config?

ASP.NET 3.5, Visual Studio 2008:

<assemblies>
  <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
  <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
  <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
+2

:) web.config:

<assemblies>  
    <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>  
    <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>  
    <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>  
    <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>  
    <add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>

:

<%@ Import Namespace="System.Linq" %>

@Will,

. :)

+2

, 3.5, 2.0.

, "var" # 3 (.. VS2008), 3.5.

, dll .

+1

var hello - Linq.

System.Core


Sorry, I was not clear. I meant adding System.Corelinks to a web project, not a page.

Import the page basically just uses instructions to skip the namespace on the page.

0
source

The csproj file may not have a System.Core link. Locate the line in the csproj file as follows:

<Reference Include="System" />

And add the line below it as follows:

<Reference Include="System.Core" />
0
source

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


All Articles