cool hit counter [Tip] How to make the reference to the dll accompanying xml comments document, pdb debug library and other files do not appear in the project output directory_Intefrankly

[Tip] How to make the reference to the dll accompanying xml comments document, pdb debug library and other files do not appear in the project output directory


The project output directory (bin/debug|release) often looks like this.

main.exe
main.pdb 
a.dll
a.xml
b.dll
b.pdb
b.xml
...

Where xml is the annotation documentation for the dll of the same name and pdb is the debugging library. We should only want the exe and dll eventually, and besides deleting them manually, there are two tricks I know of to keep the xml and pdb from appearing after the project is generated:.

1. Use the project [Generate Events]. There is a generated event in the project properties, with two events, pre and post, so you can write the delete statement in the post event. Supported here are cmd command line statements, example.

del /f /q /a $(TargetDir)a.xml
del /f /q /a $(TargetDir)b.pdb

 rem can also be used with the wildcard character
del /f /q /a $(TargetDir)x?x*.xml

One problem, which doesn't work for web projects, is that it's gone from the local bin directory, but the bin directory on the server will have it. I guess the web project publishing action is not first into the local bin, and then copy the past, but possibly first into a temporary directory, and then copy from the temporary directory to the bin and remote respectively, so only delete the bin in the unhelpful, the key is to delete the temporary directory, I guess is the obj directory, practice another day, a clear friend hope to be able to guide. I had previously used this trick until today when I learned the following new trick.

2. Add element nodes to the project csproj fileAllowedReferenceRelatedFileExtensions . The details are as follows.

<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>
...

AllowedReferenceRelatedFileExtensions As you can see from the name, it is dedicated to this (compared to what generating events can do), the parent element PropertyGroup is usually divided into two nodes Debug and Release (the example above is the Release node), Allow... element added to Debug will work when generating the debug version, same for release, can be added to both debug/release, or can have different configurations, e.g. allow pdb for debug and block it for release. .allowedextension is the type of files allowed to be included, e.g. .pdb means pdb files are allowed to be included, then pdb may appear in the bin. Multiple types can be separated by semicolons, such as .pdb;.xml, so that both pdb and xml are allowed to be included.Wildcard not supported ; leaving it blank would be any file allowed, so if you want to block pdb and xml, you have to get an extension other than them both, like .allowedextension above. BTW, learned this trick from stackoverflow.http://stackoverflow.com/questions/2011434/preventing-referenced-assembly-pdb-and-xml-files-copied-to-output

It should be noted that whether the project's own pdb and xml are generated or not is correctly set in [Project Properties Generation]. The Generate Event method works on the project's own related files, but Allow... The element method does not, it is only valid for the files associated with the referenced assembly.

-Bunbi-


Recommended>>
1、codecombat is coming to China You can learn to program without a teacher Programming Thinking Alchemy practicing programming skills in games
2、OHAUS AR series balances are honorably retired and the PX series balances rock
3、Zen Path Video Series 006
4、Huawei works its magic for the second time with the Honor Magic II
5、Xinhuasan Winning the Shanghai Metro Urban Rail Cloud Project

    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号