Slimming down your build – don’t copy the intellisense files!

So you know how a lot of nuget packages include intellisense XML files and they get copied to your output binaries folder during build?

I did a quick web search but soon for how to fix this, but soon gave up and resorted to searching my msbuild .targets files instead. Finally I found it. The AllowedReferenceRelatedFileExtensions variable.

Just add this to your .csproj (or .props or .targets file depending on how you're structuring your build).

    <!-- note: This controls what files *related to a DLL* are copied to the output directory with the dll.
         Setting custom AllowedReferenceRelatedFileExtensions to just .pdb and .pri - EXCLUDE .xml so that
         all sorts of giant intellisense XML files are not copied to the bin directories!
         You can override this per-project if you really want the .xml files for some reason -->

Of course once I discovered the variable, it was *easy* to find many other people already knew about this. I was just failing to find it, sigh.


Comments (0)

Skip to main content