V
V
Vadim2022-03-20 19:36:53
.NET
Vadim, 2022-03-20 19:36:53

What is the file format and extension of a typical .net core backend application?

Hello everyone,

in order for a .net core application to work, let's say it is published for the Linux platform - what is the typical format and extension of these binary files? Does .net need to be installed on the platform where such a .net application will run?

all the best,
Vadim

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2022-03-21
@Viji

Does .net need to be installed on the platform where such a .net application will run?

When you publish an application for Linux, it will be with a Linux executable file extension.
Namely, with none.
If you publish a platform-independent application, then there will be .dll and in any case you will need the installed runtime.
Does .net need to be installed on the platform where such a .net application will run?

If published with the --self-contained or --self-contained true flag, then it is not needed.
If published without the --self-contained flag or with the --self-contained false flag, then it is needed.
You could check all this yourself by simply compiling hello world.
PS: here is what is specifically produced as a result:
C:/workspace
❯ dotnet new console -o DemoLinuxPublish
Шаблон "Консольное приложение" успешно создан.

Идет обработка действий после создания...
Выполнение "dotnet restore" для C:\workspace\DemoLinuxPublish\DemoLinuxPublish.csproj...
  Определение проектов для восстановления...
  Восстановлен C:\workspace\DemoLinuxPublish\DemoLinuxPublish.csproj (за 113 ms).
Восстановление выполнено.


C:/workspace took 2s
❯ cd .\DemoLinuxPublish\

C:/workspace/DemoLinuxPublish via .NET v6.0.100  net6.0 took 12s
❯ dotnet publish -c Release -r linux-x64 --self-contained -v q --nologo -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=None -p:DebugSymbols=false -p:PublishReadyToRun=true -p:PublishTrimmed=true

C:/workspace/DemoLinuxPublish via .NET v6.0.100  net6.0 took 2s
❯ ls .\bin\Release\net6.0\linux-x64\publish\

    Directory: C:\workspace\DemoLinuxPublish\bin\Release\net6.0\linux-x64\publish

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---          21.03.2022     3:25       15866695 DemoLinuxPublish

PPS: I messed around a bit with the extra build options

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question