Share via


/langversion (Conformant Syntax) (C# Compiler Options)

Causes the compiler to only accept syntax that is included in the ISO/IEC 23270:2003 C# language specification.

/langversion:option

Arguments

  • option
    If option is ISO-1 the compiler will give an error for any syntax that is not in the ISO/IEC 23270:2003 C# language specification.

    If option is ISO-2 the compiler will give an error for any syntax that is not in the ISO/IEC 23270:2006 C# language specification.

    If option is default the compiler will accept all valid language syntax. /langversion:default is the default.

Remarks

Version 1.0 of the C# specification represents the functionality available with /langversion:ISO-1. The Visual Studio Developer Center contains all specifications as Microsoft Word files. The ISO/IEC 23270:2006 specification is available at http://standards.iso.org/ittf/PubliclyAvailableStandards/c042926\_ISO\_IEC\_23270\_2006(E).zip.

Metadata referenced by your C# application is not subject to /langversion compiler option.

Because each version of the C# compiler contains extensions to the language specification, /langversion does not give you the equivalent functionality of an earlier version of the compiler.

Regardless of which /langversion setting you use, you will use the current version of the common language runtime to create your .exe or .dll. One exception is friend assemblies and /moduleassemblyname (Specify Friend Assembly for Module) (C# Compiler Option), which work under /langversion:ISO-1.

To set this compiler option in the Visual Studio development environment

  1. Open the project's Properties page. For details, see How to: Set Build Properties (C#).

  2. Click the Build property page.

  3. Click the Advanced button.

  4. Modify the Language Version property.

For information about how to set this compiler option programmatically, see LanguageVersion.

See Also

Other Resources

C# Compiler Options

Project Properties (Visual Studio)