Turn off Visual Basic 14 language features in Visual Studio 2015

If you're on a team that's doing solution round-tripping between Visual Studio 2013 and 2015, then it's usually a good idea to turn off the latest Language features. That way you don't break the 2013 users, yet are able to use all the other new goodies that 2015 brings.

The C# Project Properties offer a nice UI feature to do this, even though it's well hidden in the property pages.

Visual Basic .NET doesn't have the UI, but it does have the same feature. When you change the property in the UI of the C# project it sets a tag in your project file:


<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <LangVersion>3</LangVersion>
  </PropertyGroup>

Doing the same thing in your .vbroj actually has the desired result:


<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <DefineDebug>true</DefineDebug>
    <DefineTrace>true</DefineTrace>
    <OutputPath>bin\Debug\</OutputPath>
    <DocumentationFile>ConsoleApplication1.xml</DocumentationFile>
    <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
    <LangVersion>11</LangVersion>
  </PropertyGroup>

This is the result:

Leave a comment.