简体   繁体   English

缺少类型或命名空间名称

[英]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). 如果我在根文件夹中有我的类(不在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 一旦我将它们移动到App_Code文件夹中,它就会编译,但运行它会显示旧的

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? 我不明白如何将类移动到App_Code文件夹会导致整个事物分崩离析?

Project target is .Net 4 on VWD 2010 Express 项目目标是VWD 2010 Express上的.Net 4

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): 您必须修改Web应用程序的web.config文件以使其编译并使用.net 3.5(或者在您的情况下可能更高):

<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. 我的答案是在System.Data.Linq的属性窗口中将Local Copy设置为True。

The reference is System.Linq, not System.Data.Linq. 引用是System.Linq,而不是System.Data.Linq。

How is your reference declared? 您的参考如何申报?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 msbuild 失败,缺少类型或命名空间名称 - msbuild fails with type or namespace name missing 类型或名称空间名称在名称空间中不存在“是否缺少程序集引用?” - The type or namespace name does not exist in the namespace ''are you missing an assembly reference ?" 命名空间中不存在类型或命名空间名称(您是否缺少程序集引用?) - The type or namespace name does not exist in the namespace (are you missing an assembly reference?) 在全局命名空间中找不到类型或命名空间名称“”Namespace“(您是否缺少程序集引用?) - The type or namespace name '“Namespace”' could not be found in the global namespace (are you missing an assembly reference?) 在全局名称空间中找不到类型或名称空间名称“名称空间”(您是否缺少程序集引用?) - The type or namespace name '“Namespace”' could not be found in the global namespace (are you missing an assembly reference?) Oracle找不到类型或名称空间名称Oracle缺少指令 - Type or namespace name Oracle could not found Missing Directive 缺少程序集引用和/或指令“找不到类型或命名空间名称” - Missing assembly references and/or directives “The type or namespace name could not be found” 找不到类型或名称空间名称(缺少使用指令或程序集引用吗?) - Type or namespace name could not be found (missing using directive or assembly reference?) 当引用或使用指令中包含“类型或名称空间&#39;名称&#39;时丢失” - “The type or namespace 'name' is missing” when it is included in references and using directives CS0234:命名空间“<namespace1>”中不存在类型或命名空间名称“<namespace2>”。 (你错过了一个程序集引用吗?) - CS0234: The type or namespace name '<namespace2>' does not exist in the namespace '<namespace1>.' (are you missing an assembly reference?)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM