开发者

Compilation Error with XDocument

开发者 https://www.devze.com 2023-04-04 10:45 出处:网络
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 ha

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开发者_StackOverflow中文版 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.


Add this to the top of the class...

Using System.Xml.Linq

If you still get the error, add the System.Xml.Linq.dll reference to your project.

0

精彩评论

暂无评论...
验证码 换一张
取 消