1

我有一个带有一些条件构建的项目。我编译它。然后用dotpeek看了一下。我注意到所有条件语句和它包装的代码,即使没有定义。

由于此应用程序针对不同的客户端以某些关键方式进行了修改,因此我希望该客户端的构建具有包含已定义的活动 #ifs 的二进制文件。

我怎样才能实现这一目标的自动化构建?

4

1 回答 1

3

dotPeek does 2 things

  1. it can decompile IL code
  2. it can read the PDB file and look up the source file

You can see this in the context menu. One entry is "Decompiled sources" and the other is "Sources from symbol files":

Context menu

By double clicking an item, it will first try to perform action 2, which is: show the source file that exists on your hard disk.

Here you see a very simple program:

  • left: Sources from symbol files
  • middle: Decompiled sources
  • right: IL code

As you can see, the compiled code only contains those parts which it was compiled for.

Comparison

Therefore, there's no need to strip those parts in a build script, because the DLL or EXE does not contain it.

于 2017-11-18T14:16:44.567 回答