Why is .NET6 self-containing app too slow?

620 views Asked by At

I have app in .NET6, my deployment manager needs them as a self-contained. So, I have changed YAML build command to following:

- task: DotNetCoreCLI@2
  displayName: Publish service
  inputs:
    command: publish
    projects: <my project>.csproj
    publishWebProjects: True
    arguments: '--self-contained true --configuration $(BuildConfiguration) --no-restore --output "$(Build.ArtifactStagingDirectory)\service" -p:Version=$(GitVersion.FullSemVer) /p:DebugType=None /p:PublishTrimmed=true /p:PublishSingleFile=true /p:IncludeAllContentForSelfExtract=true /p:InformationalVersion=$(GitVersion.InformationalVersion)'
    zipAfterPublish: false

In project file there are added new elements:

<RuntimeIdentifier>win10-x64</RuntimeIdentifier>

and appsettings.json files have added elements:

<CopyToPublishDirectory>Always</CopyToPublishDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>

There is really produced a "single file" deployment (only file: Microsoft.Data.SqlClient.SNI.pdb lies next to).

But starting of the app takes ~ 30 minutes!? Reactions are 1000 times slower in comparation with non-self-contained deployment

What's wrong? How to diagnose it please?

Thanks for your answers, Petr

0

There are 0 answers