Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linq + Invalid expression term '>'

Tags:

c#

.net

linq

Can anyone help me here, the following works fine on my xp but not my vista machine. Im querying a Generic dictionary.

Both computers have .NET 3.5 + SP1, 3.0, 2.0, etc., and have the web project targeted to 3.5 Framework.

using System.Linq;
string val = "Test";
var d = DictionaryOfStuff().Where(n => n.Key.ToLower().Contains(val.ToLower()));

Gives me the error: CS1525: Invalid expression term '>'

I can run this in a differnet project on vista, I have IIS configured to use .NET 2.0 and the project in VS targeted at 3.5 I have even tried adding this to the web.config, it compiles fine w/o any lambda/linq

like image 734
schmoopy Avatar asked Jun 18 '09 01:06

schmoopy


2 Answers

Well, here was the answer..

I changed the project to target .NET 3.0, tried to compile got all kinds of errors, changed it back to 3.5 and it compiled fine.

I musta had an old reference in there from something.

like image 140
schmoopy Avatar answered Oct 20 '22 12:10

schmoopy


Based on the error message, I would have to say there is a configuration issue on your Vista machine and the web projects are using the 2.0 compiler instead of the 3.5 compiler. This is the only reason I can think of that you would get this message.

Make sure that

  • IIS is configured properly
  • Web settings are configured properly.
like image 37
JaredPar Avatar answered Oct 20 '22 13:10

JaredPar