从相同的源代码生成的两个DLL文件中有哪些区别? [英] What are these differences in two DLL file generated from the same source code

查看:336
本文介绍了从相同的源代码生成的两个DLL文件中有哪些区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我所有的代码都在源代码控制下,因此我100%确信源代码没有更改.但是,如果我两次构建一个C#DLL,它们的内容就会略有不同.我可以仅通过构建然后再构建一次来100%地重现该问题.

All my code is under source control, so I'm 100% sure that the source code hasn't changed. But if I build a C# DLL two times their content is slightly different. I can reproduce the problem 100% of the time by just building, and then building again.

这似乎根本不影响程序,但是这些微小的变化使用于从两个MSI文件创建补丁的工具MSIMSP之类的东西变得毫无用处. (针对我的产品)制作的补丁比实际补丁大40倍.

This doesn't seem to impact the program at all, but tools like MSIMSP, used for creating patches from two MSI files are thrown off by these minute changes. Making patches (for my product) 40x bigger than they should be.

我已经反编译了DLL,并且它们的汇编信息,类等都完全相同.文件的大小也完全相同,但是创建时间当然不同.所以我真的无法理解发生了什么变化.

I've decompiled both DLLs and their assembly information, classes, etc... are exactly the same. The files are also exactly the same size, but of course have a different creation time. So I really cannot fathom what has changed.

所以我更深入了.

我使用WinDiff查找更改,然后在十六进制编辑器中交叉引用了这些更改. WinDiff显示第二个行"中的更改,并且该行中的更改大约占文件的80%.

I've used WinDiff to find the changes and then cross referenced these in a hex editor. WinDiff shows a change in the second 'line' and in a line at about 80% of the file.

在十六进制编辑器中,我看到更改的第一个字节是字节0x088(字节136).这似乎是此行"上唯一更改的字节.我很难找到第二个更改,因为WinDiff不会告诉我更改的确切字节偏移量.

In the hex editor I see that the first byte that is changed is byte 0x088 (byte 136). This seems to be the only byte changed on this 'line'. I trouble finding the second change as WinDiff doesn't tell me the exact byte offset of the change.

这是更改的图像,正确的文件是较新文件的内容.

Here is an image of the changes, the right file is the contents of the newer file.

任何熟悉(C#)DLL文件组成的人都知道更改的字节可能意味着什么吗?或更妙的是,如何在重建DLL文件时确保它们完全相同?

Does anybody familiar with the make-up of (C#) DLL files know what the changed byte might mean? Or better yet how to make sure that DLL files stay exactly the same when you rebuild them?

推荐答案

这可能与Build和ReBuild之间的差异有关

This might have something to do with differences between Build and a ReBuild

> Build Solution与Rebuild Solution之间的差异,以及在Visual Studio中清理解决方案?

如果它不需要重建项目,则不需要.有可能 如果它们没有变化,也可以使用部分构建的项目

if it doesn't think it needs to rebuild a project, it won't. It may also use partially-built bits of the project if they haven't changed

执行构建使用幕后的元数据,因此您的dll可能会不同

Performing a build uses metadata behind the scenes and thus your dll's can be different

为什么完全编译后生成的另一个dll,没有代码更改吗?

解决方案:

您将需要执行如这里

这篇关于从相同的源代码生成的两个DLL文件中有哪些区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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