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.
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
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.
Pingback: Dew Drop - November 22, 2017 (#2609) - Morning Dew
Hi,
Nice post! I wrote a similar post a few weeks ago which also describe how to change the C# version from the properties panel or directly in the csproj: https://www.meziantou.net/2017/08/24/3-ways-to-enable-the-latest-c-features