/langversion (Visual Basic)
Updated: July 20, 2015
For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.
Causes the compiler to accept only syntax that is included in the specified Visual Basic language version.
Required. The language version to be used during the compilation. Accepted values are
/langversion option specifies what syntax the compiler accepts. For example, if you specify that the language version is 9.0, the compiler generates errors for syntax that is valid only in version 10.0 and later.
You can use this option when you develop applications that target different versions of the .NET Framework. For example, if you are targeting .NET Framework 3.5, you could use this option to ensure that you do not use syntax from language version 10.0.
You can set
/langversion directly only by using the command line. For more information, see Targeting a Specific .NET Framework Version.
The following code compiles
sample.vb for Visual Basic 9.0.
vbc /langversion:9.0 sample.vb