Click here to Skip to main content
15,849,678 members
Articles / Programming Languages / C#

How to change targeted C# version in Visual Studio

Rate me:
Please Sign up or sign in to vote.
4.94/5 (37 votes)
14 Jan 2015CPOL2 min read 289.9K   17   18
I found that changing targeted C# version for a project in Visual Studio is bit tricky. And even if you choose old .NET framework version, Visual studio will use default C# version to compile C# code, until you explicitly set the targeted C# version.


I was doing some experiment with C# 6 using Visual Studio 2015 Preview. I created two projects and for one project I wanted to target C# 6 which is default in Visual Studio 2015 so no effort is needed in this case. But for other project I wanted to write code doing same thing but targeting C# 5, in order to compare and appreciate how better it is now in C# 6. I found that to set targeted C# version is not straightforward in Visual Studio. It is very simple but tricky so I will share that trick here.

Changing targeted C# Version

To target desired version of language for a project in Visual Studio, we need to take following steps:

  • Open the project properties window:
    1. Right click on the Project Name
    2. Select "Properties" (last option in menu)
    Above steps are shown below with reference numbering:

    Project Propeties

  • Modify Project Properties as per below steps:
    1. Select "Build" from left hand side options
    2. Scroll down till end and click on "Advance" button.
    3. It will open a popup and there you will get "Language Version" dropdown
    4. Select desired version of C# and Click "OK"
    Above steps are shown below with reference numbering:

    Provide Value for Parameter

Default versions of C#

By default following are corresponding version of C# compilers for Visual Studio:

  1. Visual Studio 2015: C# 6.0
  2. Visual Studio 2013: C# 5.0
  3. Visual Studio 2012: C# 5.0
  4. Visual Studio 2010: C# 4.0
  5. Visual Studio 2008: C# 3.0
  6. Visual Studio 2005: C# 2.0
  7. Visual Studio.NET 2003: C# 1.2
  8. Visual Studio.NET 2002: C# 1.0


Hope this tip may help and save time for beginners to Visual Studio and trying to change targeted C# Version. Your comments and suggestions are most welcome to make this article more useful. Thanks.


C# - Wikipedia Page


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Written By
Software Developer
India India
I am a Software Developer working on Microsoft technologies. My interest is exploring and sharing the awesomeness of emerging technologies.

Comments and Discussions

QuestionC# version Pin
Member 1379567924-Apr-18 3:20
Member 1379567924-Apr-18 3:20 
AnswerRe: C# version Pin
OriginalGriff24-Apr-18 3:23
mveOriginalGriff24-Apr-18 3:23 
QuestionVS 2015 Community Pin
Edward_7530-Mar-17 7:40
Edward_7530-Mar-17 7:40 
GeneralMy vote of 5 Pin
Member 1182599831-Aug-15 7:17
Member 1182599831-Aug-15 7:17 
GeneralRe: My vote of 5 Pin
Snesh Prajapati31-Aug-15 16:43
professionalSnesh Prajapati31-Aug-15 16:43 
QuestionIs there a way to change the default? Pin
priteshacharya20-Aug-15 7:33
priteshacharya20-Aug-15 7:33 
AnswerRe: Is there a way to change the default? Pin
Snesh Prajapati20-Aug-15 8:19
professionalSnesh Prajapati20-Aug-15 8:19 
SuggestionIt's a tip! Pin
_Dhull 4-Aug-15 21:23
_Dhull 4-Aug-15 21:23 
GeneralMy vote of 5 Pin
rosdi18-May-15 8:25
rosdi18-May-15 8:25 
AnswerRe: My vote of 5 Pin
Snesh Prajapati18-May-15 16:55
professionalSnesh Prajapati18-May-15 16:55 
QuestionInteresting - my results vary Pin
B. Clay Shannon19-Jan-15 11:37
professionalB. Clay Shannon19-Jan-15 11:37 
AnswerRe: Interesting - my results vary Pin
Snesh Prajapati19-Jan-15 18:00
professionalSnesh Prajapati19-Jan-15 18:00 
QuestionWhy? Pin
Gorpik15-Jan-15 3:00
Gorpik15-Jan-15 3:00 
AnswerRe: Why? Pin
PeterLudvik15-Jan-15 3:24
professionalPeterLudvik15-Jan-15 3:24 
GeneralRe: Why? Pin
Gorpik15-Jan-15 5:26
Gorpik15-Jan-15 5:26 
GeneralRe: Why? Another Reason Pin
ozbear15-Jan-15 11:54
ozbear15-Jan-15 11:54 
GeneralMy vote of 5 Pin
Sid_Joshi14-Jan-15 20:09
professionalSid_Joshi14-Jan-15 20:09 
GeneralRe: My vote of 5 Pin
Snesh Prajapati14-Jan-15 20:12
professionalSnesh Prajapati14-Jan-15 20:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.