Home > Enterprise >  dotnet publish CLI exclude .pdb
dotnet publish CLI exclude .pdb

Time:03-15

I do (.NET 7):

dotnet publish --self-contained --configuration Release --runtime win7-x64 --output myapp

How do I prevent '.pdb' files in the result ? Ideally just using the CLI ?

Are there any additional steps I can take to decrease the result size ?

CodePudding user response:

According to this GitHub issue, there are two ways you can disable symbols.

You can either edit the .csproj file to add these two entries:

<DebugType>None</DebugType>
<DebugSymbols>False</DebugSymbols>

Or you can pass the following as part of the dotnet publish command:

/p:DebugType=None /p:DebugSymbols=false

For example:

dotnet publish /p:DebugType=None /p:DebugSymbols=false --self-contained --configuration Release --runtime win7-x64 --output myapp
  • Related