none
Deploying .net core SCD generates lots of files RRS feed

  • Question

  • I am generating a SCD deployed app of simplest Hello world kind.
    (VS2019 and .Net Core 2.1 Console APP)

    This works just fine, but why is 214 dll's packaged in the publish folder?
    If I delete one of them for which I am pretty sure is not used in any way, it indeed generates a missing dll error message (and refuses to launch) if I try to launch the app.exe

    Something can be done to reduce to actually needed files?

    Saturday, April 13, 2019 9:08 AM

All replies

  • Hi EuroEager

    Sorry for this delay in reply.

    When you create a self-contained deployment, .NET Core tools automatically include the latest serviced runtime of the .NET Core version that your application targets. (The latest serviced runtime includes security patches and other bug fixes.) The serviced runtime is downloaded automatically from NuGet.org. Please refer to here for more information. 

    If you deploy on Linux system, you can use .NET Core globalization invariant mode to reduce the size. 

    Hope it can help you.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com


    Monday, April 15, 2019 3:38 AM
  • Thank yoy

    This was what I observed too (and probably very well documented).

    However, my main question was not answered:
    "Something can be done to reduce to actually needed files?"

    I guess MS must have created some kind of trimming tool or better, build it into VS.
    Perhaps I am wrong, but I guess it should be fairly simple too analyse which assemblies are actually accessed within app and reduce the *.deps.json accordingly (and delete the actual dll's as well)

    Tuesday, April 16, 2019 8:36 AM
  • Hi EuroEager,

    Sorry for this misunderstanding.

    There are two build tools to reduce the unused assemblies for the .net core applications. And we can use them by dotnet command line.

    Dependency Trimming -- It provides build infrastructure for trimming the output of an application. Please refer to here.

    dotnet add package Microsoft.Packaging.Tools.Trimming -v 1.1.0-preview1-25818-01
    dotnet publish ...

    .NET IL Linker -- It is built on top of the excellent and battle-tested mono linker. It can reduce the size of application by 50%. Please refer to here.

    dotnet new nuget
    //Open nuget.config and add <add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
    dotnet add package ILLink.Tasks -v 0.1.4-preview-981901
    dotnet publish ..

    Of course, they can be used together.

    dotnet new nuget
    //Open nuget.config and add <add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
    dotnet add package ILLink.Tasks -v 0.1.4-preview-981901
    dotnet add package Microsoft.Packaging.Tools.Trimming -v 1.1.0-preview1-25818-01
    dotnet publish ..

    Hope it can help you.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com


    Tuesday, April 16, 2019 10:12 AM
  • Thanks a lot

    However, I tried the Dependency Trimming tool, but the content of the publish folder is exactly as before...

    Tuesday, April 16, 2019 1:20 PM
  • Hi,

    Sorry for my mistake.

    We should use the latest version of the package which is 26619 and add the command line "p:TrimUnusedDependencies=true" to make the tool work.

    Please have a try the following command line :

    dotnet add package Microsoft.Packaging.Tools.Trimming -v 1.1.0-preview1-26619-01
    dotnet publish -r win-x86 -c release /p:TrimUnusedDependencies=true

    Hope it can work in your side.

    Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com


    Thursday, April 18, 2019 7:03 AM
  • Thanks, but still sorry to say that nothing happens.

    One message from console after the "dotnet publish -r win-x86 -c release /p:TrimUnusedDependencies=true" command:
    Trimmed 0 out of 219 files for a saving of 0 MB

    Obviously something very basic that I misunderstand...

    Thursday, April 18, 2019 2:50 PM
  • Hi,

    I have a try in my side, and it can work normally.Please check the following image:

    From the image, the command path “D:\.Net Core\ConsoleApp2\ConsoleApp2” is the directory where the project file locates. And then I run the app in the publish folder, it also could output message. 

    Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Friday, April 19, 2019 3:09 AM