I’m using dotnet publish to publish app for linux 64 to be deployed in app service in Azure. The command used is:
dotnet publish ./_redacted_ --configuration Release --output ./publish/api -r linux-x64 -f net6.0
This gives me 130 MB of artifacts.
Now, when I create publish profile in VS that looks like below:
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<DeleteExistingFiles>true</DeleteExistingFiles>
<ExcludeApp_Data>false</ExcludeApp_Data>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>binReleasenet6.0publishtest-linux64</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<_TargetId>Folder</_TargetId>
<SiteUrlToLaunchAfterPublish />
<TargetFramework>net6.0</TargetFramework>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<ProjectGuid>ca580b3f-7e3d-472c-a61b-dfb39711945e</ProjectGuid>
<SelfContained>false</SelfContained>
</PropertyGroup>
</Project>
It produces only 40 MB of artifacts. When I compare those folders I see that dotnet publish
includes .net runtime.
Since this app is hosted in App Service in Azure I don’t think I need to have all that in the publish folder since the stack is specified in the azure resource itself.
Is there anything I’m missing from the CLI call to help to reduce the size of the artifacts?