title: Support for C# 9.0 in Visual Studio
body: <p>How can I turn on the support for the records keyword in C# 9.0?</p>
  <p>When I try to use the new <code>record</code> keyword (or the <code>init</code>), I get an <em><strong>unexpected token</strong></em> error in Visual Studio.</p>
  <p>What am I missing? Or is C# 9.0 not supported in Visual Studio 16.8?</p>
  <pre class="lang-cs prettyprint-override"><code>public record Person
  {
      public string? FirstName { get; init; }
      public string? LastName { get; init; }
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/i0XRK.png" rel="noreferrer"><img src="https://i.stack.imgur.com/i0XRK.png" alt="Error Screenshot" /></a></p>
  <hr />
  <blockquote>
  <p><strong>Update</strong>: Just read the marked answer. The information below ended up not being important for this problem and is here just for documentation purposes.</p>
  </blockquote>
  <hr />
  <p>I am using Visual Studio 16.8 with the language set to <code>9.0</code> in my project file.</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;Project Sdk=&quot;Microsoft.NET.Sdk.Web&quot;&gt;
  
    &lt;PropertyGroup&gt;
      &lt;LangVersion&gt;9.0&lt;/LangVersion&gt;
      &lt;TargetFramework&gt;net5.0&lt;/TargetFramework&gt;
      &lt;GenerateDocumentationFile&gt;true&lt;/GenerateDocumentationFile&gt;
      &lt;NoWarn&gt;$(NoWarn);1591&lt;/NoWarn&gt;
      &lt;Nullable&gt;enable&lt;/Nullable&gt;
    &lt;/PropertyGroup&gt;
  
  
    &lt;ItemGroup&gt;
      &lt;PackageReference Include=&quot;Microsoft.AspNetCore.ApiAuthorization.IdentityServer&quot; Version=&quot;3.1.8&quot; /&gt;
      &lt;PackageReference Include=&quot;Microsoft.EntityFrameworkCore.Design&quot; Version=&quot;3.1.9&quot;&gt;
        &lt;PrivateAssets&gt;all&lt;/PrivateAssets&gt;
        &lt;IncludeAssets&gt;runtime; build; native; contentfiles; analyzers; buildtransitive&lt;/IncludeAssets&gt;
      &lt;/PackageReference&gt;
      &lt;PackageReference Include=&quot;Swashbuckle.AspNetCore&quot; Version=&quot;5.6.3&quot; /&gt;
    &lt;/ItemGroup&gt;
  
  &lt;/Project&gt;
  </code></pre>
  <h3>Visual Studio Version</h3>
  <p><a href="https://i.stack.imgur.com/i9YEx.png" rel="noreferrer"><img src="https://i.stack.imgur.com/i9YEx.png" alt="Visual Studio Version" /></a></p>
  <h3>Installed SDKs</h3>
  <pre class="lang-sh prettyprint-override"><code>2.1.2 [C:\Program Files\dotnet\sdk]
  2.1.104 [C:\Program Files\dotnet\sdk]
  2.1.201 [C:\Program Files\dotnet\sdk]
  2.1.202 [C:\Program Files\dotnet\sdk]
  2.1.301 [C:\Program Files\dotnet\sdk]
  2.1.400 [C:\Program Files\dotnet\sdk]
  2.1.508 [C:\Program Files\dotnet\sdk]
  2.1.700 [C:\Program Files\dotnet\sdk]
  2.1.801 [C:\Program Files\dotnet\sdk]
  2.2.300 [C:\Program Files\dotnet\sdk]
  3.0.100 [C:\Program Files\dotnet\sdk]
  3.1.201 [C:\Program Files\dotnet\sdk]
  5.0.100 [C:\Program Files\dotnet\sdk]
  </code></pre>
  <h3>Proof that it's running .NET 5.</h3>
  <p>So to make sure it's really running .NET 5, I have created a route to output the .NET runtime version. Looks like it's really running .NET 5.</p>
  <p><a href="https://i.stack.imgur.com/A1d4l.png" rel="noreferrer"><img src="https://i.stack.imgur.com/A1d4l.png" alt="enter image description here" /></a></p>