21

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.

BrettRobi
  • 3,793
  • 7
  • 40
  • 64
  • 2
    possible duplicate of [Preventing referenced assembly PDB and XML files copied to output](http://stackoverflow.com/questions/2011434/preventing-referenced-assembly-pdb-and-xml-files-copied-to-output) – ShawnFeatherly Jul 01 '13 at 22:55

3 Answers3

31

You can also specify this via the command line:

MsBuild.exe build.file /p:AllowedReferenceRelatedFileExtensions=none
ElasticCode
  • 7,311
  • 2
  • 34
  • 45
mwjackson
  • 5,403
  • 10
  • 53
  • 58
15

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

tahir
  • 1,016
  • 1
  • 11
  • 21
-4

If you are using Visual Studio, select properties on the file and select "Copy to Output Directory" = "Do not Copy"

Taylor Bird
  • 7,767
  • 1
  • 25
  • 31
  • 1
    But the file is not part of my project. It sits in the same folder as a 3rd party assembly that my project references (such as log4net). VS2010 and MSBuild seem to think I want it deployed with my app, not sure why. – BrettRobi Feb 25 '11 at 01:29
  • Are you building with Visual Studio defaults? Or some other tool (TeamCity, TeamBuild, etc)? Are you packaging for deployment, or just building? – Taylor Bird Feb 25 '11 at 02:23
  • I'm using msbuild, or the VS 2010 UI. Both building and packaging include the xml files. It seems whatever process in the msbuild pipeline decides what files 'belong' with the deployed binaries is the culprit. – BrettRobi Feb 25 '11 at 15:42