0

I have a a little .NET Core console application that I would like to make a self-contained file of. Not only that, I would also like to create a self-contained file that will run on CentOS.

The issue I am having is when I run dotnet publish -r linux-x64 -c release --self-contained true I get multiple files and the files seem to be configured for Windows only. I also tried removing <OutputType>Exe</OutputType>. This makes sure there isn't any EXE file file when publishing, but I still get multiple files that I am not sure if they can even run on CentOS since they are only .dll files. My target framework is set to <TargetFramework>net4.8</TargetFramework>.

Here are some visuals of the output I am getting:

Having <OutputType>Exe</OutputType> set in my .csproj:

Enter image description here

Having <OutputType>Exe</OutputType> removed:

Enter image description here

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
MWhatsUp
  • 41
  • 6

1 Answers1

0

As pointed out by Jonathon Chase and Herohtar, I targeted the wrong framework. The framework I used (net4.8) is Windows only.

The correct framework to use would be something like netcoreapp3.0.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
MWhatsUp
  • 41
  • 6