linuxasp.net-corecoreclr

Can I reduce the number of packages when deploying ASP.NET Core to Linux?


I am able to deploy CoreCLR ASP.NET apps to Linux. To do this I am using

dnu publish --no-source -o <dest-dir>

which gives me a dest-dir full of many CoreCLR packages, one of which is a package for my published app specifically.

This folder is pretty big, around 50 MB for the simple Web Application Basic (no auth) described at https://azure.microsoft.com/en-us/documentation/articles/web-sites-create-web-app-using-vscode/ .

Can I get rid of a bunch of those CoreCLR packages somehow?


Solution

  • You are already publishing without runtime (--runtime option on dnu publish) which reduces the bundle size significantly.

    You need to get somehow those packages on the server. Even if you deploy only the sources, you'll have to restore which will download the same amount of packages. Also, running from sources makes the application start significantly slower (depending on the number of dependencies).

    However, if you publish the entire bundle once and you app's dependencies don't change, you can upload only the folders corresponding to your projects, instead of re-uploading all the dependencies.