Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish a single file app does not create a single file #44337

Closed
JoeMarkov opened this issue Nov 4, 2020 · 8 comments
Closed

Publish a single file app does not create a single file #44337

JoeMarkov opened this issue Nov 4, 2020 · 8 comments
Labels
area-Single-File untriaged New issue has not been triaged by the area owner

Comments

@JoeMarkov
Copy link

Version Used:
C:\Temp\HelloConsole>dotnet --version
5.0.100-rc.2.20479.15

Steps to Reproduce:

  1. Creating a new dotnet console application
  2. Publish it as a single file using

dotnet publish -r win-x64 -p:PublishSingleFile=true --self-contained true
or
dotnet publish -r win10-x64 /p:PublishSingleFile=true

  1. then I get these files created:

11/04/2020 02:54 PM

.
11/04/2020 02:54 PM ..
09/25/2020 10:47 PM 747,912 clrcompression.dll
09/25/2020 10:46 PM 1,324,416 clrjit.dll
09/25/2020 10:47 PM 5,154,696 coreclr.dll
11/04/2020 02:54 PM 53,289,026 HelloConsole.exe
11/04/2020 02:50 PM 9,352 HelloConsole.pdb
09/25/2020 10:46 PM 1,042,792 mscordaccore.dll

Expected Behavior:

I would expect to only get one file.

Actual Behavior:

I get many files. So bit confused here.... Why I don't get a single file?. I get the same result when I publish from inside visual Studio as well.

@Dotnet-GitSync-Bot
Copy link
Collaborator

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@PathogenDavid
Copy link
Contributor

PathogenDavid commented Nov 5, 2020

Roslyn doesn't handle single file publishing, this issue is better suited for https://github.com/dotnet/runtime and would beThis issue is a duplicate of #43071

Currently single file publishing is only single file as far as the managed .NET portions of your app are concerned. As such, some extra files have to be included for native runtime components unless you specify --self-contained false. (Except on Linux where the native components are statically linked to the resulting executable.)

I believe #43556 fixed this, but I'm pretty sure it didn't make the .NET 5 release so you'll have to wait for .NET 6.

@jaredpar jaredpar transferred this issue from dotnet/roslyn Nov 6, 2020
@Dotnet-GitSync-Bot
Copy link
Collaborator

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label Nov 6, 2020
@ghost
Copy link

ghost commented Nov 6, 2020

Tagging subscribers to this area: @agocke, @vitek-karas
See info in area-owners.md if you want to be subscribed.

@vitek-karas
Copy link
Member

For .NET 5 this is the expected behavior - see the detailed design here: https://github.com/dotnet/designs/blob/main/accepted/2020/single-file/design.md#user-experience

We're working on improving this for future releases - most of the work to get to one file even on Windows is tracked here: #43071

@steveoh
Copy link

steveoh commented Dec 10, 2020

As such, some extra files have to be included for native runtime components unless you specify --self-contained false.

Isn't this the default?

@vitek-karas
Copy link
Member

@steveoh Unfortunately the behavior of dotnet CLI is a bit weird:

  • If there's no RuntimeIdentifier specified (so the app is built as portable), then --self-contained is defaulted to false.
  • It RuntimeIdentifier is specified (which is a requirement for single-file), then --self-contained is defaulted to true.

@agocke
Copy link
Member

agocke commented Feb 11, 2021

As of .NET 6 Preview 1, both Windows and Mac should now compile all the runtime binaries into a single-file, and publishing should produce a true single-file app.

Any native dependencies that the app itself brings in can be bundled and extracted using IncludeNativeBinariesForSelfExtract

@agocke agocke closed this as completed Feb 11, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Mar 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Single-File untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

7 participants