0

I am trying to use Auto-implemented properties in VS2005. I have .NET 3.0 framework loaded on my machine, but Visual Studio is still compiling with .NET 2.0. How do I tell it to use .NET 3.0?

Brettski
  • 19,351
  • 15
  • 74
  • 97
  • I think that you mean C# 3.0, not .NET 3.0, since auto-implemented properties were added in C# 3.0 (which shipped with .NET 3.5). .NET 3.0 was the WPF/WCF/WF release. – Andy Apr 03 '09 at 22:05
  • Wow, nice and straight forward are the releases, Thanks Andy, I think the is the answer I needed. – Brettski Apr 03 '09 at 22:20

3 Answers3

6

Unfortunately, I don't think it is possible to do this, since that is a feature of the C# compiler. Visual Studio 2005 is hard-coded to use the C# 2.0 compiler. You need to upgrade to Visual Studio 2008 to use the new C# 3.0 features.

Andy
  • 30,088
  • 6
  • 78
  • 89
  • .NET 3.0 was released before vs2008, how were we to use the new framework when it was released? – Brettski Apr 03 '09 at 22:08
  • At the time, there was a WPF CTP, and a WCF CTP that added the ability to write .NET 3.0 apps to VS2005. Since VS2008 supports them by default, those CTPs are no longer supported. – Andy Apr 03 '09 at 23:16
3

Autogenerated properties require C#3.0 which isn't available in VS2005. You need to use VS2008 to get the autogenerated property syntax.

tvanfosson
  • 524,688
  • 99
  • 697
  • 795
0

Go to your project properties. Under the application tab you can change your Target Framework

Jason Irwin
  • 1,985
  • 2
  • 29
  • 42