Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to exclude xml doc files from msbuild

Tags:

I used a number of third party assemblies in my C# projects. Many of them include xml document files that I believe give me intellisense? Anyway, when I build my projects those xml files end up in the bin folder. Is there any way to exclude them so that they do not get deployed with my app (beside removing them from the location I reference the assembly in)?

This problem has always bugged me but never enough to pursue. Now I seem to have 4MB worth of XML files in my deployment folder and it bothering me enough to seek a solution.

like image 985
BrettRobi Avatar asked Feb 25 '11 00:02

BrettRobi


People also ask

How do I not use XML files?

The setting is in the Properties of the project in question, under the "Build" tab, uncheck "XML documentation file".


2 Answers

You can also specify this via the command line:

MsBuild.exe build.file /p:AllowedReferenceRelatedFileExtensions=none 
like image 176
mwjackson Avatar answered Sep 24 '22 10:09

mwjackson


You can edit your csproj in notepad and add the section <AllowedReferenceRelatedFileExtensions > within the <PropertyGroup >of the desired configuration (I didn't managed to do it in visual studio csproj properties windows...)
For exemple if you add .pdb in this section, only .pdb files will be copied in bin folder. I set it to .none to have only assemblies in my deployment

like image 34
tahir Avatar answered Sep 23 '22 10:09

tahir