Using Quick Actions in Visual Studio to upgrade project’s language version

By | November 22, 2017

In Visual Studio, you have seen the light bulb, if there is an error, Visual Studio provides a suggestion for how to fix the issue.  We all are familiar with this feature of Visual Studio. Did you know – you can use this feature to update the project language version as well.  In the previous post Choosing the C# Language latest version (minor release ) in Visual Studio 2017 we have seen how we can update the latest minor or major version of languages. This post talks about how you can update it directly using Quick Actions features.

Consider your project is targeting to C# 7.0 version ( set a default as major version)  and you are trying to C# 7.2 ( minor version of the release) language feature.

 

Upgrade Language Version Error

Upgrade Language Version Error

Now, In this case, you can see a warning message, indicates we are trying to use a language feature which is not available in C# 7.0 . If you need this feature, we have to go ahead and upgrade the language version. In such case, we tend to manually change the project language version.

Related Post : 

 

However, a little press of Ctrl+. ( Quick Actions), will brings up the fix and where it will ask you to upgrade the project

Upgrade Language Version using Quick Action

Upgrade Language Version using Quick Action

Select the option from the quick fix, and you are good to go with.

Hope this helps

One thought on “Using Quick Actions in Visual Studio to upgrade project’s language version

  1. Giselle

    Do you mind if I quote a couple of your posts as long as I provide credit and sources back to your blog? My blog is in the same niche as yours, and my users would benefit from some of the information you provide here. Please let me know if this ok with you. Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *

Verify Captcha * Time limit is exhausted. Please reload the CAPTCHA.