Invalid namespace type or name

This is strange, not the one I came across before. My project meets the requirements and works fine if I have classes in the root folder (not in App_Code).

As soon as I moved them to the App_Code folder, it will be compiled, but its launch will cause the old

  CS0234: The type or namespace name 'Linq' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)

I don’t understand how moving the class (s) to the App_Code folder makes it all fall apart there?

The goal of the project is .Net 4 at VWD 2010 Express

+4
source share
3 answers

You need to modify the web.config file of your web application so that it compiles and uses .net 3.5 (or maybe higher in your case):

<system.web> <compilation> <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> </compilation> </system.web> <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> </compilers> </system.codedom> 
+5
source

I had the same problem. The answer for me was to set Local Copy to True in the properties window for System.Data.Linq.

+3
source

The link is System.Linq, not System.Data.Linq.

How is your link advertised?

0
source

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


All Articles