Psytronic
Psytronic

Reputation: 6113

Missing type or namespace name

This is an odd one, not one I've come across before. My project complies and runs fine if I have my classes in the root folder (Not in App_Code).

As soon as I move them into the App_Code folder then it will compile, but running it will bring up 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(es) to the App_Code folder causes the whole thing to fall apart there?

Project target is .Net 4 on VWD 2010 Express

Upvotes: 4

Views: 5424

Answers (3)

BlooSki
BlooSki

Reputation: 79

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

Upvotes: 3

Juan Nunez
Juan Nunez

Reputation: 529

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

How is your reference declared?

Upvotes: 0

Matthias
Matthias

Reputation: 1032

You have to modify the web.config file of your web application to make it compile and use .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>

Upvotes: 5

Related Questions