How to exclude files with specific extension from your web deploy package

i had to re-visit the topic of Web Deploy Package and how to exclude specific files from your package.

and sometimes you get even better results then second round you check how to do something.
and if you re like me "Mr. i did it before but now i have no idea how" you will get that chance a lot!

actually this is one of the main reasons i started this blog, it's kind of my personal information technology, development and DevOps notes that i share with the world.

so i wanted to remove all debug (*.pdb), all dll.config and all xml files from my package bin folder.

first i found some search results that mention using "ExcludeFilesFromDeployment" tag in your pubxml publish profile file, but examples was to remove a single file by name, or even a multiple by using ; as a delimiter.
then i though, what if i tried some common wild card patterns in there. so i came up with this under the "Project" tag
<ExcludeFilesFromDeployment>bin\**\*.pdb;bin\**\*.dll.config;bin\**\*.xml</ExcludeFilesFromDeployment>

hope this works for you!

Popular posts from this blog

how to copy NuGet packages from one project to another

Visual Studio, Blazor WASM, and Docker