views:

1099

answers:

3

Hi guys

I'm pretty aware that Visual Studio 2010 works with C# 4.0. But now I was wandering if I'm able to test C# 4.0 features with Visual Studio 2008.

I did that one time, using C# 3.0 with Visual Studio 2005 hacking the app.config file.

Did anyone have any success using C# 4.0 in VS2008?

I've installed Net Framework 4.0 beta, rebooted, created a new WPF application, chosen Application properties, but the Target Framework can be set only to Net Framework 3.5.

+10  A: 

No. You can't use .NET 4.0 with VS2008, and you can't use the C# 4.0 features either - it's exactly the same situation as trying to make VS2005 cope with C# 3.0. The editor, Intellisense etc just don't know about the new features.

One important aspect is that even though it looks like Visual Studio is just using the external csc.exe compiler, it isn't - there's another "in-process" one. That in-process compiler is tied to the version of Visual Studio it comes with, so it only knows about the language features which were available at the time.

Jon Skeet
For completeness (since I am sure you know), there's a new CLR 4.0 as well, whereas the .NET Framework 3.0 and 3.5 used CLR 2.0.
Richard Hein
True - although wouldn't *necessarily* mean you couldn't use some of the language features, just like you can use a lot of C# 3 features when targeting .NET 2.0.
Jon Skeet
@Richard - so they skipped CLR 3.0?
quillbreaker
@quillbreaker: Yes. The libraries, languages and CLR are all going to be 4.0.
Jon Skeet
+2  A: 

The 3.0 and 3.5 .NET libraries were just add-ons to 2.0. So it ws possible to test work done in VS 2008 using VS 2005 if you didn't use any 3.0 or 3.5 features.

My understanding is that the 4.0 is entirely new libraries, so I doubt you will be able to load or use them in VS 2008/2005.

RB Davidson
A: 

It's a shame :( I, too, want to use C# 4.0 in Visual Studio 2008. I find Visual Studio 2010 ugly and strange. What is up with the caret for instance? Why does it appear black for half a second, then grey, then disappear? I know I'm just looking at a beta version, but that caret couldn't be unintentional, could it? You would think implementing the caret would be the easiest part.

Maybe I just have to get used to VS2010's look, but I sure don't like it.

Thomas

Thomas
Hey Thomas, do you have this problem as told on http://social.msdn.microsoft.com/Forums/en-US/csharpide/thread/8fd24108-aa7f-4ee8-a5d9-8633470dc81d ?
Junior Mayhé
I'm wandering if the highlighting is working for you too. http://winterdom.com/2009/06/current-line-highlighting-for-vs2010
Junior Mayhé