Buildalyzer icon indicating copy to clipboard operation
Buildalyzer copied to clipboard

Buildalyzer should be able to build projects with C# 12 language features

Open REscobar opened this issue 1 year ago • 0 comments

I'm trying to build a .net 8 project which uses some of the new C# 12 language features such as collection expressions, the build fails and the usage of the new features are reported as comipile errors.

The following does not compile

    internal class Program
    {
        static void Main(string[] args)
        {
            List<string> list = [];
        }
    }

I directly referneced the following dependencies and the code now builds

    <PackageReference Include="Microsoft.Build" Version="17.10.4" />
    <PackageReference Include="Microsoft.Build.Tasks.Core" Version="17.10.4" />
    <PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.10.0" />
    <PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.10.0" />
    <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.10.0" />
    <PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="4.10.0" />
    <PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.10.0" />

The required dependencies should be updated to support C#12 language features

REscobar avatar Jul 23 '24 14:07 REscobar