简体   繁体   中英

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.

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM