Skip to content

Building in CI is very slow #7450

@BeyondEvil

Description

@BeyondEvil

I'm having an issue where building a project locally (from a cleaned state) takes about 20 seconds whilst in CI it takes almost 2 minutes.

I've run the build with:

dotnet build MyProject --no-restore -bl -p:ReportAnalyzer=true

When inspecting the binlog, I find:

1:06.124   Microsoft.CodeAnalysis.CSharp.Analyzers, Version=3.3.5.2003, Culture=neutral, PublicKeyToken=31bf3856ad364e35
    Microsoft.CodeAnalysis.CSharp.Analyzers.MetaAnalyzers.CSharpDiagnosticAnalyzerApiUsageAnalyzer (RS1022) = 1:05.998

and according to #6676 these analyzers shouldn't run for a ASP.NET project.

I tried the workaround suggested above. This is from packages.lock.json:

      "Microsoft.CodeAnalysis.Analyzers": {
        "type": "Direct",
        "requested": "[3.11.0, )",
        "resolved": "3.11.0",
        "contentHash": "v/EW3UE8/lbEYHoC2Qq7AR/DnmvpgdtAMndfQNmpuIMx/Mto8L5JnuCfdBYtgvalQOtfNCnxFejxuRrryvUTsg=="
      },
MyProject.csproj
<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <GenerateDocumentationFile>true</GenerateDocumentationFile>
    <RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
  </PropertyGroup>
  <ItemGroup>
    <Content Remove="log4net.config" />
  </ItemGroup>
  <ItemGroup>
    <None Include="log4net.config">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="AutoMapper" Version="13.0.1" />
    <PackageReference Include="AWSSDK.Core" Version="3.7.400.15" />
    <PackageReference Include="AWSSDK.Extensions.NETCore.Setup" Version="3.7.301" />
    <PackageReference Include="AWSSDK.S3" Version="3.7.402.6" />
    <PackageReference Include="ClosedXML" Version="0.102.3" />
    <PackageReference Include="EasyNetQ" Version="7.8.0" />
    <PackageReference Include="HtmlAgilityPack.NetCore" Version="1.5.0.1" />
    <PackageReference Include="ITfoxtec.Identity.Saml2.MvcCore" Version="4.12.6" />
    <PackageReference Include="log4net" Version="2.0.17" />
    <PackageReference Include="log4net.Ext.Json" Version="2.0.10.1" />
    <PackageReference Include="Magick.NET-Q16-AnyCPU" Version="13.10.0" />
    <PackageReference Include="Microsoft.AspNetCore.DataProtection.EntityFrameworkCore" Version="8.0.8" />
    <PackageReference Include="Microsoft.AspNetCore.SignalR.Common" Version="8.0.8" />
    <PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="8.0.8" />
    <PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.0" />
    <PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="8.0.0" />
    <PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.2" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="6.7.3" />
    <PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="6.7.3" />
    <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.8" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.8" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.8" />
    <PackageReference Include="Microsoft.AspNetCore.Owin" Version="8.0.8" />
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.8" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.8" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.8" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.4" />
    <PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\MyOtherProject.Common\MyOtherProject.Common.csproj" />
  </ItemGroup>
  <ItemGroup>
    <_ContentIncludedByDefault Remove="wwwroot\Index.html" />
  </ItemGroup>
</Project>

What am I missing?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions