Using any LINQ + XML in Visual Studio 2008 ASP.NET causes "BC30201: Expression expected" error
I have an existing web shop created in VB.NET (for the ASP + code behind) and C# (libraries). Originally, the site was developed in Visual Studio 2005 with .NET 2.0. Recently we moved to .NET 3.5 and converted the project using the VS2008 wizard, and today I tried to do some XML processing using LINQ in the code behind of an ASP.NET page.
LINQ gives the possibility to use XML literals mixed with your code. According to MS it is possible to use it in ASP + VB, as long as you put your XML in the code behind, as it won't work in the ASP page itself. Whatever I tried, I *can* build the solution but get a "BC30201: Expression expected" error when I move there while debugging. The line pointed at is the first line of the XML literal.
I then tried it with an example from MSDN, found here:
http://msdn2.microsoft.com/en-us/library/bb384692.aspx (see code section). Result: same error.
I then tried it in a simple stand-alone VB project (inside the same solution). This worked like a charm.
Note again that I *can* build the whole solution. I've cleaned it, restarted it, restarted my PC, but, needless to say, to no avail. Did I overlook something? Ideas are very welcome!
PS: I've done/added/checked the following:
- Imports System.Xml.Linq
- Imports System.Linq
- the System.Core, System.Linq and System.Xml.Linq are all referenced ok.
- and yes, the Target Framework is ".NET Framework 3.5"