Saito404
Saito404

Reputation: 23

Do not copy XML documentation files from NuGet packages into bin

I can't seem to find a way to prevent XML documentation files from NuGet packages (such as Dapper for example) from being copied into bin folder. I'm using VS2015.

Upvotes: 2

Views: 1094

Answers (1)

Mr Qian
Mr Qian

Reputation: 23740

Try to add these node in your xxx.csproj file:

<PropertyGroup>
<AllowedReferenceRelatedFileExtensions>Dapper.xml</AllowedReferenceRelatedFileExtensions>
</PropertyGroup>

Then, clean your project and then build your project.

After that, you will not see Dapper.xml file in your bin folder.

===========================================

Update 1

The above solution will prevent all such suffix files not being copied into output folder.

Since you do not want to prevent all such suffix files in the output folder and just want only one file not to be copied into bin folder, you can try this:

<Target Name="RemoveFilesAfterBuild" AfterTargets="AfterBuild">
        <ItemGroup>
            <XMLFilesToDelete Include="$(TargetDir)\Dapper.xml"/>           
        </ItemGroup>
        <Delete Files="@(XMLFilesToDelete)" />      
</Target>

Upvotes: 3

Related Questions