0

I successfully used sgen.exe to create my MyLibrary.XmlSerializer.dll assembly, because I want to avoid the waste of time for the "first" deserialization.

But now, how to use it?

I mean, where do I have to put MyLibrary.XmlSerializer.dll to be used? How to be sure?

Thanks!

4

1 回答 1

1

只需将它与您的 MyLibrary.dll 放在同一个文件夹中,如果它与您的 MyLibrary.dll 匹配,它将自动使用(例如,如果它已过期,则不会使用它,您的库的每个新版本都需要新的 sgen 运行)。

您可以检查它是否已使用 Process Explorer 等外部工具加载。在 Process Explorer 中,打开进程的属性窗口并检查“.NET Assemblies”选项卡。如果您的 MyLibrary.XmlSerializer.dll 已加载,它将在那里列出。

但要注意:如果过期也会显示为已加载(当然,否则无法检查是否过期)。如果为 XML 序列化创建了一个临时程序集,该程序集也将在那里显示。通常它有一个随机名称(如“uki54k3f”)并且不显示路径。因此,如果您在创建XmlSerializer它的实例后在您的程序集列表中有这样一个随机名称,则表明您的 Sgen 程序集未被使用。

于 2014-04-07T09:55:22.827 回答