Core: dotnet publish - way to remove pdb and other files

Created on 24 Oct 2019  路  5Comments  路  Source: dotnet/core

Hi,

I am using dotnet publish to publish my dotnet core 2.2 web application. I notice that the published folder has several unrequired files, specifically .pdbs, .appsettings.Development, .runtimeconfig.dev etc.

Qn: Is there a way dotnet publish command can be made to exclude these files or would I have to delete these manually?

Thanks

Most helpful comment

Using Property group in .csproj with <DebugType>None</DebugType> and <DebugSymbols>false</DebugSymbols> must be done on each referenced .csproj to apply on each referenced assemblies.

Using dotnet publish parameters /p:DebugType=None /p:DebugSymbols=false apply on each referenced assemblies.

All 5 comments

@livarcocc @jeffschwMSFT

Hi @scalablecory @livarcocc @jeffschwMSFT,

please let me know if there is a way to remove these unnecessary files during publish.

Same question with dotnet core 3.1 web application. Any way to remove those unrequired files using command line parameters or .csproj PropertyGroup properties? DebugType=None and DebugSymbols=false seem to be ignored.

Using Property group in .csproj with <DebugType>None</DebugType> and <DebugSymbols>false</DebugSymbols> must be done on each referenced .csproj to apply on each referenced assemblies.

Using dotnet publish parameters /p:DebugType=None /p:DebugSymbols=false apply on each referenced assemblies.

@saxenark did the answer given by @ducalai solve your problem?

Was this page helpful?
0 / 5 - 0 ratings