none
Can't set Language Version to C# 4.0 in Visual Studio 2010

    Question

  • We have a Visual Studio 2010 solution with C# projects that targets the .NET framework 4. Developers in the team are free to choose any higher development environment, but since we support a minimum framework requirement of 4, setting the "Target framework" project property to ".NET Framework 4" works. Starting VS 2010, since opening projects in higher versions does not require a project upgrade, all was well until one developer chose to use a feature of C# 5.0 from VS 2015. We found out that the C# language version is tied to the VS version and that we could additionally set the Language version on projects. I changed this setting from my VS 2012:

    .Language Version

    When I open and build the same project in VS 2010, I get this error:
    Error 1 Invalid option '4' for /langversion; must be ISO-1, ISO-2, 3 or Default

    How can solve this problem given that I don't want multiple project files targeting different Visual Studio versions?

    Thanks!
    Priya.


    Tuesday, August 16, 2016 8:50 AM

Answers