为什么一个不同的dll一个干净的构建后产生的,而且没有更改代码? [英] Why is a different dll produced after a clean build, with no code changes?

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

问题描述

当我做一个干净的构建我的C#项目,所产生的DLL是不同,那么先前建一(我单独保存)。没有代码进行了更改,只是干净,重建家园。



DIFF显示了DLL一些字节有变化 - 近几年开始,很少接近尾声,但我不能找出这些代表。是否有人对为什么发生这种情况以及如何防止它的见解?



这是使用Visual Studio 2005 /的WinForms



更新:未使用自动版本递增,或签署大会。如果它是某种形式的时间戳,如何防止我从VS写它?



更新:在寻找ILDASM /差异后,它看起来像下面的项目是不同的:




  • 两个字节的PE头的文件的开头

  • < PrivateImplementationDetails> {的GUID 的}部分

  • 临近结束的字符串表的隐秘部分(不知道为什么,我没有改变的字符串)

  • 在年底的集信息零件文件。



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


< DIV CLASS =h2_lin>解决方案

我最好的猜测是你看到的是在构建时自动生成的内部使用的元数据列的修改字节。



有些ECMA-335分区Ⅱ(CLI规范元数据定义),可以每建造改变,即使源代码并没有改变列:




  • Module.Mvid:构建时生成的GUID。总是变化,每次构建

  • AssemblyRef.HashValue:。如果你在引用也已经因为旧版本重建另一个大会可以修改



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

 视图>元信息>原料:标题,模式,行//重要的,否则你从下一步

视图>非常基本的信息;元信息>显示!


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.

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?

This is using Visual Studio 2005 / WinForms.

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?

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

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

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: A build-time-generated GUID. Always changes, every build.
  • AssemblyRef.HashValue: Could change if you're referencing another assembly that has also been rebuilt since the old build.

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!

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

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