visual studio - VS2008 targeting .NET 2.0 doesn't stop me from using C# 3 features -


I had a VS2005 solution and wanted to get VS 2005 for the new year. I was mostly happy with the upgrade process and it was pleasantly surprised to see that my build script works primarily still.

My question is around multi-targeting feature - .NET 3.5 is not installed on my server., So I have to continue targeting the Net 2.0. It has worked, mostly, but I came to know that I can do things like

var returnMe = "result:" + result.ToString ();

... and still debug this project successfully

When I got that server up to the build server, the build failed, saying "var" "Was not defined.

So, what should I expect?

  • VS2008, targeting .NET 2.0, when I try to do things in C # 3 then errors must be thrown
  • build server, I know that I I am targeting .NET 2.0, I should understand that I am doing this and compiling it in a 2.0-compatible binary
  • Any ideas?

    The problem is that the build server does not have the right compiler You can make it on your workstation, okay?

    Many .NET 3.0 "FEATURES" are just syntax bits that come back to the CLR2 code in a timely manner. var is one of them - when it is compiled, the compiler converts var to the appropriate type.

    There is a beautiful informative post on it

    Comments

    Popular posts from this blog

    oracle - The fastest way to check if some records in a database table? -

    php - multilevel menu with multilevel array -

    jQuery UI: Datepicker month format -