pdb files appear in website publish folder
Follow the instructions step-by-step to prevent PDB files being generated after publish:
I have attached screenshot with all steps using MS Visual Studio Community 2017 version:
The informational text on the Publish Web dialog, says:
Publish uses settings from "Package/Publish Web" and "Package/Publish SQL" tabs in Project Properties.
So to prevent PDB files being published, you can:
- Delete all the PDB files from the existing publish location, if any exist. (They will not be deleted automatically).
- Right-click on your project -> Properties and select the Package/Publish Web tab.
- Ensure the Exclude generated debug symbols box is checked.
Now when you publish your project, the PDBs will be omitted.
The PDB files will be there from your last build under debug. Check the properties to check when they were modified or delete to see if they come back.
Another way is to edit the pubxml
file (under Properties
/ PublishProfiles
of your web project).
I have then add bin\**\*.pdb
(**
is there to mean any hierarchy even none between bin
and your pdb
files) to the node ExcludeFilesFromDeployment
.
The pubxml
thus look like this :
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- ... -->
<WebPublishMethod>FileSystem</WebPublishMethod>
<ExcludeFilesFromDeployment>bin\**\*.pdb</ExcludeFilesFromDeployment>
</PropertyGroup>
</Project>