[英]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.