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
0 comments No comments
{count} votes

Accepted answer
  1. Anna Xiu-MSFT 31,056 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 Answers by the question author, which helps users to know the answer solved the author's problem.