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.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,888 questions
0 comments No comments
{count} votes

Accepted answer
  1. Anna Xiu-MSFT 27,891 Reputation points Microsoft Vendor
    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