title: How to build .Net Core 5 project with Language Version 'preview' using Azure Pipeline?
body: <p>I have a .Net Core DLL project which builds in Visual Studio 2019 Preview but when I try to build using an Azure Pipeline, I receive a long list of errors related to new language in the preview SDK.</p>
  
  <h2>Here is part of the csproject file:</h2>
  
  <pre><code>&lt;PropertyGroup&gt;
      &lt;TargetFramework&gt;net5.0&lt;/TargetFramework&gt;
      &lt;Nullable&gt;enable&lt;/Nullable&gt;
      &lt;LangVersion&gt;preview&lt;/LangVersion&gt;
      &lt;NeutralLanguage&gt;en-US&lt;/NeutralLanguage&gt;
      WarningsAsErrors&gt;NU1605;CS8600;CS8601;CS8602;CS8603;CS8604;CS8610;CS8613;CS8614;CS8618;CS8619;CS8625;CS8629;CS8714&lt;/WarningsAsErrors&gt;
      &lt;AllowUnsafeBlocks&gt;true&lt;/AllowUnsafeBlocks&gt;
    &lt;/PropertyGroup&gt;
  </code></pre>
  
  <h2>Here is the Azure Pipeline yml:</h2>
  
  <pre><code># ASP.NET Core
  # Build and test ASP.NET Core projects targeting .NET Core.
  # Add steps that run tests, create a NuGet package, deploy, and more:
  # https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
  
  trigger:
  - master
  
  pool:
    vmImage: 'windows-latest'
  
  variables:
    buildConfiguration: 'Release'
  
  steps:
  - task: UseDotNet@2
    displayName: 'Install .Net Core SDK'
    inputs:
      packageType: 'sdk'
      version: '5.0.100-preview.4.20258.7'
  
  - task: NuGetAuthenticate@0
    displayName: 'Authenticate'
  
  - script: dotnet build --configuration $(buildConfiguration)
    displayName: 'Build Project'
  
  - task: DotNetCoreCLI@2
    displayName: 'Pack Project'
    inputs:
      command: 'pack'
      packagesToPack: '**/*.csproj'
      versioningScheme: 'off'
  
  - task: DotNetCoreCLI@2
    displayName: 'Push Nuget Package'
    inputs:
      command: 'push'
      packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
      nuGetFeedType: 'internal'
      publishVstsFeed: 'my feed key'
  </code></pre>
  
  <h2>Here are the errors:</h2>
  
  <pre><code>Starting: dotnet build Release
  ==============================================================================
  Task         : Command line
  Description  : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
  Version      : 2.164.1
  Author       : Microsoft Corporation
  Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
  ...
  Welcome to .NET 5.0!
  ---------------------
  SDK Version: 5.0.100-preview.4.20258.7
  ...
  --------------------------------------------------------------------------------------
  Microsoft (R) Build Engine version 16.7.0-preview-20220-01+80e487bff for .NET Core
  Copyright (C) Microsoft Corporation. All rights reserved.
  ...
  Barcodes/AztecCode.cs(1007,19): error CS1002: ; expected [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
  Barcodes/AztecCode.cs(1007,23): error CS1002: ; expected [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
  ZPLProcessor/ZPLProcessor.cs(102,102): error CS8124: Tuple must contain at least two elements. [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
  Barcodes/AztecCode.cs(1007,23): error CS1513: } expected [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
  ZPLProcessor/ZPLProcessor.cs(102,103): error CS1526: A new expression requires (), [], or {} after type [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
  Barcodes/AztecCode.cs(1007,26): error CS1002: ; expected [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
  Barcodes/AztecCode.cs(1007,26): error CS1513: } expected [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
  Barcodes/AztecCode.cs(1009,13): error CS1002: ; expected [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
  Barcodes/AztecCode.cs(1009,13): error CS1513: } expected [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
  Barcodes/AztecCode.cs(1012,5): error CS1022: Type or namespace definition, or end-of-file expected [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
  Barcodes/AztecCode.cs(1014,2): error CS1022: Type or namespace definition, or end-of-file expected [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
  Barcodes/AztecCode.cs(1015,1): error CS1022: Type or namespace definition, or end-of-file expected [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
  Barcodes/Code93.cs(62,41): error CS8124: Tuple must contain at least two elements. [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
  Barcodes/Code93.cs(62,41): error CS1026: ) expected [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
  Barcodes/Code93.cs(62,41): error CS1526: A new expression requires (), [], or {} after type [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
  Barcodes/Code93.cs(62,44): error CS1002: ; expected [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
  Barcodes/Code93.cs(62,44): error CS1513: } expected [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
  Barcodes/Code93.cs(62,49): error CS1002: ; expected [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
  Barcodes/Code93.cs(62,49): error CS1513: } expected [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
  Barcodes/Code93.cs(62,54): error CS1002: ; expected [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
  Barcodes/Code93.cs(62,54): error CS1513: } expected [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
  Element.cs(160,81): error CS8124: Tuple must contain at least two elements. [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
  Barcodes/Code128.cs(41,41): error CS8124: Tuple must contain at least two elements. [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
  Barcodes/Code128.cs(41,41): error CS1026: ) expected [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
  Barcodes/Code128.cs(41,41): error CS1526: A new expression requires (), [], or {} after type [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
  Barcodes/Code128.cs(41,44): error CS1002: ; expected [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
  Barcodes/Code128.cs(41,44): error CS1513: } expected [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
  Barcodes/Code128.cs(41,49): error CS1002: ; expected [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
  Barcodes/Code128.cs(41,49): error CS1513: } expected [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
  Barcodes/Code128.cs(41,54): error CS1002: ; expected [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
  Barcodes/Code128.cs(41,54): error CS1513: } expected [/home/vsts/work/1/s/CompanyName.OS.Documents/CompanyName.OS.Documents.csproj]
      0 Warning(s)
      80 Error(s)
  </code></pre>
  
  <p>I don't know what I'm doing wrong here. Why does this build in VS but the Azure Pipeline says there are errors? </p>
  
  <hr>
  
  <h2>EDIT 1</h2>
  
  <p>Here is a bit of the code causing the errors:
  Initializing bars using new language here is the issue</p>
  
  <pre><code>public static IReadOnlyList&lt;byte&gt; GetBars(string data)
  {
      // this initialization causes an error
      List&lt;byte&gt; bars = new (((data.Length + 8) * 6) + 1);
      ...
  }
  </code></pre>
  
  <p>return new (67, 1); in the function GetRSEncoder(int codewordSize) is the issue.</p>
  
  <pre><code>internal class RSEncoder&lt;T&gt; where T : struct, IConvertible
  {
      public RSEncoder(int primePoly, int initialExponent)
      {
          ...
      }
  }
  
  private static readonly ConcurrentDictionary&lt;int, RSEncoder&lt;short&gt;&gt; RSEncoders = new ConcurrentDictionary&lt;int, RSEncoder&lt;short&gt;&gt;();
  private static RSEncoder&lt;short&gt; GetRSEncoder(int codewordSize)
  {
      return RSEncoders.GetOrAdd(codewordSize, (size) =&gt;
      {
          switch (size)
          {
              case 6:
                  return new (67, 1);
  
              case 8:
                  return new (301, 1);
  
              case 10:
                  return new (1033, 1);
  
              case 12:
                  return new (4201, 1);
  
              default:
                  throw new Exception("Invalid codeword size");
          }
      });
  }
  </code></pre>