Starting with VS 2008 and new feature

A

Andrew

Ok, today I decided to open vs 2008 and start to see what's the
changes. What's the best way to try do do something? So I decided to
read a stupid xml file with LinQ ... but ... strange thing despite the
2008 is the only version avalaible on my system ... framework 3.5 is
installed when I start to use var for variable inferering ... vs start
to mark it in red ... continuing ... from x ... red again.

Definitely there is something that doesn't work? But what?
On first try I opened an old test project, not followed the automatic
conversion, but added manually the core files required, so I though to
something missing.
But the same happen with a new project too.

What could be the error?

Thanks to all.
Andrea
 
M

Michael Nemtsev

Could you check that u have declared "using System.LINQ" ?

btw, maybe in the project properties u have .NET 2.0 target settings, that's
why u have no LINQ support

VS 2008 provides multiverstion support, and when u create new solution u can
select the target version in the top righ size of the "new project" dialog box
 
J

Jon Skeet [C# MVP]

Andrew said:
Ok, today I decided to open vs 2008 and start to see what's the
changes. What's the best way to try do do something? So I decided to
read a stupid xml file with LinQ ... but ... strange thing despite the
2008 is the only version avalaible on my system ... framework 3.5 is
installed when I start to use var for variable inferering ... vs start
to mark it in red ... continuing ... from x ... red again.

Are you trying to use it for an instance variable, perhaps? Implicit
typing for variables is only available for local variables.

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
 
A

Andrew

Well

I suppose that it won't solve anything a short complete program ...
because
I'm not able to write it at all.
I mean ... also a cut and paste of some web sample will mark in red
the new
keywords ... so I exclude my mystakes.

A strange thing that I'm also noticing is that in the Application Pool
of IIS the framework listed is only the 2.0

Are 3.0 and 3.5 considered just an extension for the IIS?

I forget to say, a part of all, that I'm running on Vista.
 
A

Andrew

Could you check that u have declared "using System.LINQ" ?

I have it, and reshaper say me that I can remove because it's unused.
btw, maybe in the project properties u have .NET 2.0 target settings, that's
why u have no LINQ support

The target settings is set up on 3.5. Setting I was referering was
those one present in IIS, not in VS.

Can the problem is that I'm running on Professional Version? I noticed
this now. I just started the download of the developer edition, but I
suppose that I won't be able to run it until tomorrow morning. It's a
4gb download file.
 
A

Andrew

Also lambda expression aren't recognized. There is defintely something
wrong in this installation. But it's a fresh one, made appositely for
the VS 2008 installation. Damn.
 
J

Jon Skeet [C# MVP]

Andrew said:
I suppose that it won't solve anything a short complete program ...
because I'm not able to write it at all.

If you show a short but complete program that you expect to compile,
that will tell us whether what you expect to compile and what *should*
compile are the same thing or not.

For instance, try this:

using System;

class Test
{
static void Main()
{
var x = 10;
Console.WriteLine (x);
}
}

Does that work, in a new console app? If not, what error message do you
get?
I mean ... also a cut and paste of some web sample will mark in red
the new keywords ... so I exclude my mystakes.

Well, some web samples have mistakes too.
A strange thing that I'm also noticing is that in the Application Pool
of IIS the framework listed is only the 2.0

Are 3.0 and 3.5 considered just an extension for the IIS?

I believe so.
 
A

Alun Harford

Andrew said:
I have it, and reshaper say me that I can remove because it's unused.


The target settings is set up on 3.5. Setting I was referering was
those one present in IIS, not in VS.

Can the problem is that I'm running on Professional Version? I noticed
this now. I just started the download of the developer edition, but I
suppose that I won't be able to run it until tomorrow morning. It's a
4gb download file.

Last time I looked, Resharper didn't support C#3. They recently released
a new version though - not sure if it now supports C#3.

Alun Harford
 
M

Marc Gravell

[using System.LINQ] I have it, and reshaper say me that I can remove because it's unused.
For info, "var", lambda, etc - don't depend on this namespace - and
work even in 2.0 targets (they are compiler features, not runtime
features [lambdas as delegates, at least])
Can the problem is that I'm running on Professional Version?
Nope; should work the same on express, pro, team, etc...

Marc
 
A

Andrew

Last time I looked, Resharper didn't support C#3. They recently released
a new version though - not sure if it now supports C#3.

I upgraded to a version that supports c# and VS 2008 too (ver. 3.1) so
it should
support it.
 
A

Andrew

If you show a short but complete program that you expect to compile,
that will tell us whether what you expect to compile and what *should*
compile are the same thing or not.

For instance, try this:

using System;

class Test
{
static void Main()
{
var x = 10;
Console.WriteLine (x);
}

}

Does that work, in a new console app? If not, what error message do you
get?

It is full compiled, but var is red written. So at this point the red
color comes
from Respaher I think.

Well, some web samples have mistakes too.

I've gone to trusted sample and download those one Scott let download
from his blog / web site.
 
A

Andrew

For instance, try this:
using System;

class Test
{
static void Main()
{
var x = 10;
Console.WriteLine (x);
}

}
By the way ... this is the feedback I get.

var x = 10;

the var is red written and under x = 10 appear Cannot convert source
type 'int' into target type var.

Since I believe this is a Reshaper problem I wrote also to their
support hoping they quickly reply to me.

Thanks
Andrea
 
J

Jon Skeet [C# MVP]

Since I believe this is a Reshaper problem I wrote also to their
support hoping they quickly reply to me.

Yes - ReSharper doesn't support C# 3 yet. It will in v4. On the
installation instructions page, it states:

<quote>
NOTE: ReSharper 3.1 has experimental support for Visual Studio 2008. We
don't guarantee seamless integration and don't support C# 3.0/VB9 new
language constructs.
</quote>
 
A

Andrew

I was so convinced that latest upgrade e-mail sent me was to dispatch
an upgrade also for LINQ ... well ok.
So the problems seems to be solved.

Now I need only to find a way to disable code checking of reshaper and
let VS one works.
 
J

Jon Skeet [C# MVP]

Andrew said:
I was so convinced that latest upgrade e-mail sent me was to dispatch
an upgrade also for LINQ ... well ok.
So the problems seems to be solved.

Now I need only to find a way to disable code checking of reshaper and
let VS one works.

Resharper menu, Options, Code Inspection, "Enable code analysis" -
clear this checkbox.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top