C# - 为什么一个不同的dll后产生一个干净的构建,没有code的变化? [英] C# - Why is a different dll produced after a clean build, with no code changes?

查看:123
本文介绍了C# - 为什么一个不同的dll后产生一个干净的构建,没有code的变化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我做一个干净的构建我的C#项目,所生产的dll不同,则previously建一(我单独保存)。没有code进行了更改,只是干净和重建。

When I do a clean build my C# project, the produced dll is different then the previously built one (which I saved separately). No code changes were made, just clean and rebuild.

不同显示DLL中的一些字节有变化 - 一些附近的开始和几近尾声,但我不能找出这些重新present。没有任何人有,为什么这个见解是发生以及如何prevent呢?

Diff shows some bytes in the DLL have changes -- few near the beginning and few near the end, but I can't figure out what these represent. Does anybody have insights on why this is happening and how to prevent it?

这是使用Visual Studio 2005 /的WinForms。

This is using Visual Studio 2005 / WinForms.

更新:不使用自动版本递增,或签署大会。如果它是某种形式的,怎么我prevent VS写入它的时间戳?

Update: Not using automatic version incrementing, or signing the assembly. If it's a timestamp of some sort, how to I prevent VS from writing it?

更新:看后在ILDASM /差异,这似乎是以下项目是不同的:

Update: After looking in Ildasm/diff, it seems like the following items are different:

  • 在文件开头的PE头两个字节。
  • < PrivateImplementationDetails> { GUID 的}部分
  • 在接近尾声的字符串表的隐秘部分(不知道为什么,我没有改变的字符串)
  • 在文件的最后组装部件的信息。
  • Two bytes in PE header at the start of the file.
  • <PrivateImplementationDetails>{guid} section
  • Cryptic part of the string table near the end (wonder why, I did not change the strings)
  • Parts of assembly info at the end of file.

不知道如何消除任何这些,如果可能的话...

No idea how to eliminate any of these, if at all possible...

推荐答案

我最好的猜测将是变化的字节你看到的是那些在编译时自动生成的内部使用的元数据列。

My best guess would be the changed bytes you're seeing are the internally-used metadata columns that are automatically generated at build-time.

一些ECMA-335分区II(CLI规范元数据定义)的列,可以按建造改变,即使源$ C ​​$ C并没有改变在所有的:

Some of the Ecma-335 Partition II (CLI Specification Metadata Definition) columns that can change per-build, even if the source code doesn't change at all:

  • Module.Mvid:构建时生成的GUID。总是变化,每一个版本。
  • AssemblyRef.HashValue:如果你引用的也已经因为旧版本重建另一个大会可以更改

如果这是真的,真的困扰你,就找到了我最好的秘诀究竟是什么改变将是对差异比较实际的元数据表。获得这些的方法是使用所述ILDASM元信息窗口:

If this really, really bothers you, my best tip on finding out exactly what is changing would be to diff the actual metadata tables. The way to get these is to use the ildasm MetaInfo window:

View > MetaInfo > Raw:Header,Schema,Rows // important, otherwise you get very basic info from the next step

View > MetaInfo > Show!

这篇关于C# - 为什么一个不同的dll后产生一个干净的构建,没有code的变化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆