I want to exclude NuGet xml files from the project's build output

t-nishino 20 Reputation points
2023-10-25T01:27:16.73+00:00

When building a project with Visual Studio, xml files with the same names as the NuGet dll files is output, but since it is unnecessary for release builds, I would like to prevent it from being output.

If *.xml is specified in AllowedReferenceRelatedFileExtensions, the config file of the referenced class library project will also be excluded, so it cannot be used.

Developer technologies | Visual Studio | Other
Developer technologies | Visual Studio | Other
A family of Microsoft suites of integrated development tools for building applications for Windows, the web, mobile devices and many other platforms. Miscellaneous topics that do not fit into specific categories.
0 comments No comments
{count} votes

Answer accepted by question author
  1. Anna Xiu-MSFT 31,146 Reputation points Microsoft External Staff
    2023-10-25T11:47:39.85+00:00

    Hi @t-nishino

    Welcome to Microsoft Q&A! 

    Please right-click on your project node in the solution explorer > Properties > Build Events > add a Post-build event command line:

    del "$(TargetDir)YourAssembly.xml" 

    Note: please replace YourAssembly.xml with the name of the file you want to exclude. 

    Sincerely,

    Anna


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

     

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.