How to exclude xml doc files from msbuild

2020-08-09 06:35发布

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.

标签: xml msbuild
3条回答
够拽才男人
2楼-- · 2020-08-09 06:58

You can also specify this via the command line:

MsBuild.exe build.file /p:AllowedReferenceRelatedFileExtensions=none
查看更多
虎瘦雄心在
3楼-- · 2020-08-09 07:01

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

查看更多
叼着烟拽天下
4楼-- · 2020-08-09 07:19

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

查看更多
登录 后发表回答