在項目.csproj文件
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
</PropertyGroup>
節點中加入元素節點AllowedReferenceRelatedFileExtensions。
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<AllowedReferenceRelatedFileExtensions>
<!-- 阻止默認的 XML 和 PDB 文件復制到 RELEASE 的輸出目錄.
只有*.allowedextension 擴展名的文件可以被包含, 當然這個擴展的文件並不存在.
-->
.allowedextension
</AllowedReferenceRelatedFileExtensions>
</PropertyGroup>
轉自:http://www.codebye.com/c-winform-output-remove-xml-pdb-files.html