Preventing referenced assembly PDB and XML files copied to output

Preventing referenced assembly PDB and XML files copied to output

Asked on December 28, 2018 in XML.
Add Comment


  • 3 Answer(s)

         Prevent the referenced assembly PDB and XML files copied to output had specified by the command line given,

    MsBuild.exe build.file /p:AllowedReferenceRelatedFileExtensions=none
    
    Answered on December 28, 2018.
    Add Comment

         The alternate answer to add and delete referenced assemblies in our primary application while excepting the need to maintain which files we need to delete or exclude.

    The AllowedReferenceRelatedFileExtensions property is defaults to .pdb; .xml. The catch is that we shall need something whitespace is not sufficient or it will use the default still.

    <Project ...>
      <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
        ...
        <AllowedReferenceRelatedFileExtensions>
          <!-- Prevent default XML and PDB files copied to output in RELEASE.
              Only *.allowedextension files will be included, which doesn't exist in my case.
          -->
          .allowedextension
        </AllowedReferenceRelatedFileExtensions>
      </PropertyGroup>
    
    Answered on December 28, 2018.
    Add Comment

         A kind solution to prevent the referenced assembly PDB and XML files copied to output, we can add a Post Build event command agnate to del “$(TargetDir)YourAssembly*.xml”, “$(TargetDir)YourAssembly*.pdb”

    Answered on December 28, 2018.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.