Home > database >  docker .net 6 image magic file
docker .net 6 image magic file

Time:01-09

hello i create default asp.mvc(core) .net 6 project in visual studio 2022 with checkbox "docker -linux". After docker build -> run image all work fine!

But i find in image magic file which take 129kb with name equal project name.

I havent this file in my project! I havent it file then i try without docker, execute cmd command dotnet restore -> dotnet publish!

I try remove this file from container by hand and after restart all work fine without this file.

What is magic file ? How i can make docker images without this file? Intresting this unnecessary file take 1/2 ALL MY aplication folder space!!!

this file havent extension , this file is binaru (i think). list files:

enter image description here

cat head: enter image description here

CodePudding user response:

When you publish an app, by default dotnet creates both a platform-dependent executable and a platform-independent dll.

The web1 file is the platform-dependent executable and web1.dll is the platform-independent dll.

You can get publish to not create the platform-dependent executable by adding the following section to your .csproj file

<PropertyGroup>
  <UseAppHost>false</UseAppHost>
</PropertyGroup>

More info here: https://docs.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#useapphost

  •  Tags:  
  • Related