net5 self-contained exe misses some system DLLs

Viewed 119

I am migrating a medium-sized Win10 app (.NET Framework 4.8) to net5-windows. The solution contains about 30 projects.

While the migration process worked rather straightforward in Visual Studio 2019 (Version 16.8.3) the only problem remained to package everything in a self-contained exe. Instead of struggling with the project entries in VS, I am using the command-line method discussed by Scott Hanselmann in his blog. This also worked smooth and produced an exe of about 140MB size.

One issue remains: Not all of the system dll's are included in the exe. The following ones have to be copied manually to the directory of choice:

enter image description here

Without these DLLs the app does not work.

My question: What is the reason for this behavior, and how can these dll's be included in the self-contained exe?

1 Answers

To include a system DLLs into single file app you should use IncludeNativeLibrariesForSelfExtract property or /p:IncludeNativeLibrariesForSelfExtract=true switch for dotnet publish command, as mentioned in single file publish design document

Related