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.
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
Select the option from the quick fix, and you are good to go with.
Hope this helps