类型或名称空间名称"Linq"在名称空间"System.Data"中不存在 [英] The type or namespace name 'Linq' does not exist in the namespace 'System.Data'

查看:76
本文介绍了类型或名称空间名称"Linq"在名称空间"System.Data"中不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将项目部署到客户端服务器之一时出现错误.该系统可以在我们本地的开发和暂存环境中正常运行.错误是:

We're getting an error when deploying a project to one of our client's servers. The system works fine in our local dev and staging environments. The error is:

名称空间'System.Data'中不存在类型或名称空间名称'Linq'

The type or namespace name 'Linq' does not exist in the namespace 'System.Data'

我们已经做了显而易见的检查: -我们在web.config中有System.Data.Linq,System.Core,System.Linq等的引用. -我们项目的目标框架是3.5 -我们已经确认客户端服务器上IIS中的ASP.NET版本为2.0.50727 -我们已经确认服务器已安装框架3.5,并且在Windows/assemblies文件夹中包含System.Data.Linq DLL.

We've done the obvious checks: - We have the references in the web.config for System.Data.Linq, System.Core, System.Linq, etc. - Our project's target framework is 3.5 - We have confirmed that the ASP.NET version in IIS on the client's server is 2.0.50727 - We have confirmed that the server has framework 3.5 installed and contains the System.Data.Linq DLL in the Windows/assemblies folder.

还有其他想法吗?

推荐答案

使用脚本构建项目时,我遇到了相同的编译错误,而Visual Studio 2010可以很好地构建相同的项目.当我尝试从VS2010中添加System.Core引用时,它返回一个错误,提示该引用是隐式设置的,并且不会添加该引用.

I had the same compilation error when building a project from scripts, while Visual Studio 2010 was building the same project fine. When I tried to add the System.Core reference from within VS2010 it came back with an error saying that reference is set implicitly, and wouldn't add the reference.

对我来说,解决方案是将以下参考手动添加到csproj文件中.请注意,引用的目标框架已显式设置为3.5(这是在项目目标框架被设置为3.5之上):

The solution for me was to add the following reference manually into the csproj file. Note the reference's target framework is explicitly set to 3.5 (this is on top of the project's target framework being set to 3.5):

<Reference Include="System.Core">
  <RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>

这篇关于类型或名称空间名称"Linq"在名称空间"System.Data"中不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆