代码改变世界

避免复制引用程序集的XML文件

2019-05-17 01:02  Format Deng  阅读(396)  评论(0编辑  收藏  举报

VS在编译时,默认会复制所有引用程序集对应的XML文件到输出目录。

在项目中设置AllowedReferenceRelatedFileExtensions可以避免复制操作。

  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    ...
    <AllowedReferenceRelatedFileExtensions>
      <!-- Prevent default XML and PDB files copied to output in RELEASE. 
           Only *.allowedextension files will be included, which doesn't exist in my case.
       -->
      .allowedextension
    </AllowedReferenceRelatedFileExtensions> 
  </PropertyGroup>

 参考:https://stackoverflow.com/questions/2011434/preventing-referenced-assembly-pdb-and-xml-files-copied-to-output/8757948