XDocument 编译错误
我一直在为一家汽车经销商开发一个网站。当网站准备上线时,我们意识到他们使用的服务器是使用 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 中似乎无法找到程序集。我没有为此使用中继器,因为我需要检查某些事情,例如汽车是否经过认证,如我在页面上列出的那样,以便我可以进行更改,这似乎不适用于中继器。
如果有人对如何修复此错误或如何更有效地解决此错误有任何想法,我将非常感激。
I have been working on a website for a car dealer. When getting the website ready to go live we came to the realization that the server they use is set up with the 3.5 framework and unfortunately I had built the site in 4.0 not 3.5. After changing the site over I now get a Compilation Error.
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"));
I think the error is that I am calling my assembly references in the code behind file and then calling XDocument within the page itself so I can run the search and then Response.Write the results right onto the page. This works in 4.0 but in 3.5 it seems to not be able to find the assembly. I did not use a repeater for this because I needed to check certain things, such as if the car is certified or not as I list them on the page so I can make changes, this didnt seem to work with a repeater.
If anyone has any ideas on how to fix this error or how to go about it more effectively I would really appreciate it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将其添加到类的顶部...
如果仍然出现错误,请将 System.Xml.Linq.dll 引用添加到您的项目中。
Add this to the top of the class...
If you still get the error, add the System.Xml.Linq.dll reference to your project.