Asp.net XDocument的编译错误

Asp.net XDocument的编译错误,asp.net,linq-to-xml,Asp.net,Linq To Xml,我一直在一家汽车经销商的网站上工作。当网站准备上线时,我们意识到他们使用的服务器是用3.5框架设置的,不幸的是,我是在4.0而不是3.5中构建网站的。在更改站点之后,我现在得到一个编译错误 Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error detail

我一直在一家汽车经销商的网站上工作。当网站准备上线时,我们意识到他们使用的服务器是用3.5框架设置的,不幸的是,我是在4.0而不是3.5中构建网站的。在更改站点之后,我现在得到一个编译错误

 Description: An error occurred during the compilation of a resource required to service    this request. Please review the following specific error details and modify your source code appropriately. 

 Compiler Error Message: CS0246: The type or namespace name 'XDocument' could not be found (are you missing a using directive or an assembly reference?)

 Line 99:      //query the database to search for New cars only     
 Line 100:     XDocument feed = XDocument.Load(Server.MapPath("VEHICLES.XML"));     
我认为错误在于,我在代码隐藏文件中调用我的程序集引用,然后在页面本身中调用XDocument,这样我就可以运行搜索,然后响应。将结果直接写入页面。这在4.0中有效,但在3.5中似乎无法找到程序集。我没有使用中继器,因为我需要检查某些东西,比如我在页面上列出的汽车是否经过认证,这样我就可以进行更改,而中继器似乎不起作用


如果有人对如何修复此错误或如何更有效地处理此错误有任何想法,我将不胜感激。

将此添加到课程顶部

Using System.Xml.Linq

如果仍然出现错误,请将System.Xml.Linq.dll引用添加到您的项目中。

您没有说明编译错误是什么,这没有帮助…我在后面的代码中引用了它。但是在实际页面上,它抛出了错误。您的项目(带有出错的代码行)以System.XML.Linq.dll作为引用,并且您在该代码文件的顶部有Imports语句?是的,如果我尝试添加引用,我会收到一个错误,说它已被添加,我已经在文件顶部有了Using System.Xml.Linq语句,我假设这与Import相同,因为Import对我不起作用。我假设您已经清理并重建了解决方案好几次,但我会把它作为一个建议扔掉,以防万一。尝试删除并再次添加引用。您可能正在引用框架4中的库吗