How to add only the Dlls needed for an (-self-contained) application?

Asked

Viewed 71 times

1

To generate/publish an application on use the command:

dotnet publish -c Release --self-contained

If you have configured the .csproj with <RuntimeIdentifier>, or else use this (example if publishing to windows 10 64bit):

dotnet publish -c Release --self-contained -r windows10-x64

However when publishing I noticed that all dlls are sent, many that I don’t even use in my project, example:

dlls publicadas

Really the application only uses a few things and the only lib that I added via nuget I’m sure doesn’t use so many things, this really is normal when publishing with --self-contained, or it is possible to limit only the necessary?

  • If you publish an application with the option --self-contained will be published next to the application the full run-time of [tag:net-core]. To limit the necessary to self-contained deployment should be passed over in favour of a structure-dependent deployment option...

  • ... and therefore a comment and not an answer, because an answer would be outside the scope of the question.

  • @Augustovasques to tell you the truth, I already know the answer, but I leave it to other people to try to solve, there is way to soften, going only what is necessary, of course including the net-core-Runtime, which is a lot, but saves about 20mb on average in a simple application.

  • But how so saving memory with full Runtime-time. Are you talking about the warp netcore? If it is I do not know how to use it, but I know that significantly decreases the result.

  • 1

    @Augustovasques no, dll q really isn’t necessary, it’s just that it saves 20mb of space, or dlls, but depending on what you imported or added in the nuget it doesn’t even have effect, is that I was expecting a reasonable answer, but I’ll answer it myself, I’m just finishing up other open-source stuff here :)

1 answer

0

It’s completely normal and see why according to the Microsoft documentation:

Self-contained implantation. Unlike FDD, SCD (implantation self-contained) is not based on the presence of shared components on the target system. All components, including libraries and the . NET Core Runtime, are included with the application and isolated from other applications. NET Core. Scds include an executable file (like the app.exe on Windows platforms for an app called app), which is a renamed version of the platform-specific host . NET Core, and a . dll file (like app.dll), which is the real app.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.