Solved: .Net Core publishes lots of files for framework dependent deployment mode

By | January 23, 2020 | 0 Comment
Category: .Net Core

Issue

I have .Net Core 2.1 SDK installed on the machine. When I publish the application with deployment mode = Framework Dependent for Linux, it outputs lots of dlls including the framework dlls. There is a very minor difference in number of files between the Framework Dependent and Self Contained deployment mode.

Solution

I had the project created a while back. At the time of creation, following dependencies were added in project file (*.csproj)

<PackageReference Include="Microsoft.AspNetCore" Version="2.1.7" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />

Replace those two dependencies with the following would give bare minimum files for Framework Dependent deployment mode.

<PackageReference Include="Microsoft.AspNetCore.App" />

Explanation

Microsoft.AspNetCore.App represents the .Net core framework installed on the machine and its assemblies. It assumes that you will have needed runtime installed on the machine in order to use the application.


About Vishal Monpara

Vishal Monpara is a full stack Solution Developer/Architect with 13 years of experience primarily using Microsoft stack. He is currently working in Retail industry and moving 1's and 0's from geographically dispersed hard disks to geographically dispersed user leveraging geographically dispersed team members.