使用System.Linq的代码不能在Visual Studio 2005中编译/构建,也不会打开项目。 [英] code with using System.Linq does not compile/build in Visual Studio 2005 nor does the project open.

查看:69
本文介绍了使用System.Linq的代码不能在Visual Studio 2005中编译/构建,也不会打开项目。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的系统有.NET framework v3.0和Visual Studio 2005. 我正在尝试测试一些具有以下实现的代码:using System.Linq;

My system has .NET framework v3.0 and Visual Studio 2005.  I'm attempting to test some code that has the following implemented: using System.Linq;

当我尝试构建/编译代码时出现以下错误:  "类型或命名空间名称'Linq'在命名空间'System'中不存在(你是否缺少程序集引用?)

I get the following error when I try to build/compile the code:  "The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)

此外,当我尝试打开一个VS中的项目,在其代码中使用System.Linq,我收到以下错误消息: 

Also, when I attempt to open a project in VS, that uses System.Linq in its code,  I get the following error message: 

"无法读取项目文件'〜.csproj'。  D:\C#Reference \OIC Original \CSharp \Chap20 \〜\〜.csproj(52:11):导入的项目"D:\ Mycoftoft.CSharp target"没找到。 确认< import>中的路径声明是正确的,
该文件存在于磁盘上。" 

"Unable to read the project file '~.csproj'.  D:\C#Reference\OIC Original\CSharp\Chap20\~\~.csproj (52:11): The imported project "D:\Microsoft.CSharp targets" was not found.  Confirm that the path in the <import> declaration is correct, and that the file exists on disk." 

在另一个论坛中进行了3年的讨论,表明"你"如果您没有"System.Core.dll",则会收到此(生成)错误引用(包含核心LINQ API的程序集)。但是,当您以.NET3.5为目标时,所有默认模板都应包含此
引用。  另一条注释表明System.Core。可以在以下位置找到dll: "" C:\Program Files \ Reference Assemblies\Microsoft\Framework\v3.5 \"。  我找不到该文件在
相同的目录〜\v3.0中,我有。这个讨论论坛除了.NET3.5之外还指的是Visual Studio 2008。 

 A 3 yr old discussion in a different forum, indicated that "You'll get this (build) error if you don't have the "System.Core.dll" referenced (the assembly which contains the core LINQ APIs".  However, all the default templates should include this reference when you target .NET3.5."  An additional comment indicated that the System.Core.dll could be found in the following location: "C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\".   I couldn't find the file in the same directory ~\v3.0 that I have.  This discussion forum was referring to Visual Studio 2008 in addition to .NET3.5.  

有人能告诉我是否可以添加此System.Core.dll以访问System.Linq并编译/构建代码并打开项目吗?我怀疑问题是.Net框架的版本和/或Visual Studio的版本。 

Can anyone tell me if I can add this System.Core.dll inorder to access the System.Linq and compile/build the code and open the project?  I suspect the problem is the version of .Net framework and/or version of Visual Studio. 

谢谢,

KW

推荐答案

使用.NET 3.5添加了System.Linq命名空间。

The System.Linq namespace was added with .NET 3.5.

您尝试使用的代码是否在VS 2008中开发?我问,因为VS 2008是最老的VS版本,可以使用.NET Framework 3.5。

Was the code you are trying to use developed in VS 2008? I ask, because VS 2008 is the oldest VS version that can use .NET Framework 3.5.

因为VS 2005只能使用.NET Framework 2.0,所以这就是你的问题。

Because VS 2005 can ONLY use .NET Framework 2.0, that is your problem.

FWIW,如果您对此问题有其他疑问,请使用正确的论坛:

FWIW, if you have additional questions about this issue, the correct forum is:

http://social.msdn.microsoft.com/Forums/en-US/vssetup/threads/


这篇关于使用System.Linq的代码不能在Visual Studio 2005中编译/构建,也不会打开项目。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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