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

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

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.

Upgrade project’s language version using Quick Action

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 project's language version : 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 project's language version : 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

Abhijit Jana

Abhijit runs the Daily .NET Tips. He started this site with a vision to have a single knowledge base of .NET tips and tricks and share post that can quickly help any developers . He is a Former Microsoft ASP.NET MVP, CodeProject MVP, Mentor, Speaker, Author, Technology Evangelist and presently working as a .NET Consultant. He blogs at http://abhijitjana.net , you can follow him @AbhijitJana . He is the author of book Kinect for Windows SDK Programming Guide.

3 Comments to “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.

Comments are closed.