开发者

Missing type or namespace name

开发者 https://www.devze.com 2023-01-03 10:45 出处:网络
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).

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 ca开发者_Go百科uses the whole thing to fall apart there?

Project target is .Net 4 on VWD 2010 Express


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>


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.


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

How is your reference declared?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号