MichalStrehovsky / SeeSharpSnake

Self-contained C# game in 8 kB
618 stars 63 forks source link

dotnet examples arent self contained #1

Closed ghost closed 4 years ago

ghost commented 4 years ago

First go here:

https://dotnet.microsoft.com/download/dotnet-core/3.1

Download SDK Windows Binary x64, then extract. Then run:

dotnet new console -o sunday

Then take one of your example commands:

dotnet publish -r win-x64 -c Release /p:Mode=CoreRT sunday

this creates:

$ fd exe sunday -x wc -c
169984 sunday\bin\Release\netcoreapp3.1\win-x64\publish\sunday.exe
169984 sunday\bin\Release\netcoreapp3.1\win-x64\sunday.exe
169984 sunday\obj\Release\netcoreapp3.1\win-x64\sunday.exe

I dont know why it makes 3 of the same thing, but whatever. So if you try to run one of them, you get:

A fatal error occurred. The required library hostfxr.dll could not be found.

So how is that self contained?

MichalStrehovsky commented 4 years ago

The Mode=CoreRT thing is defined in the project file in this repo. Vanilla dotnet new doesn't know about it and won't produce self-contained executable by default.

See here: https://github.com/MichalStrehovsky/SeeSharpSnake/blob/master/SeeSharpSnake.csproj