2

No matter what, .NET will not allow me to publish the app self-contained. It fills the export directory with dozens of files. While I'm new and am not ready to publish professional apps yet, I know for a fact that this is not a user friendly approach to deploying apps. Please help me figure out why I cannot export the app in self-contained mode. Here is the command that I'm using:

dotnet publish -r win-x64 --self-contained true -c release

I'm also publishing it to Mac and Linux:

dotnet publish -r linux-x64 --self-contained true -c release
dotnet publish -r osx-x64 --self-contained true -c release

What am I doing wrong?

5
  • So far, I've tried it with this same command with my main project (which has one NuGet package), as well as a fake solution that only has Console.Writeline("Hello world!"); that should have no problems deploying. The result is the same--no self contained executable. Commented Dec 16, 2020 at 2:46
  • --self-contained [true|false] Publishes the .NET runtime with your application so the runtime doesn't need to be installed on the target machine.
    – TheGeneral
    Commented Dec 16, 2020 at 3:10
  • 1
  • @TheGeneral I'm not sure if you read the code, but I included that flag in all my tests. It didn't work. Any other ideas? Commented Dec 16, 2020 at 3:46
  • The flag doesn't do what you think it does
    – TheGeneral
    Commented Dec 16, 2020 at 4:03

1 Answer 1

0

Try this

dotnet publish -r win-x64 -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:UseAppHost=true --self-contained --configuration Release

Not the answer you're looking for? Browse other questions tagged or ask your own question.