C# assembly has different sizes after each compilation (Visual Studio)

Here is a little something we noticed today and we do not have an explanation for it.

My co worker compiled his current project (C#/WinForms/Visual Studio) and the dll was about 170 kb in size. He compiled the same project again and the dll was 220 kb in size. He did not touch anything else just hit the compile button again and the output was a much bigger file. After that the file size did not change anymore until he cleaned up the project. Then the same thing did happen: 170 kb first then 220 kb.

Is this normal? And why does it happen? Both version of the file seemed to work fine.

13.10.2009 15:25:55
Does this happen for release builds?
quillbreaker 13.10.2009 16:23:52
Yes. It does happen for release builds.
TalkingCode 14.10.2009 07:33:19
1 ОТВЕТ

When you build something you already have, it might take shortcuts to make compiling as fast as possible. When you do a full rebuild, do you get consistent results?

3
13.10.2009 15:29:48
+1. This might have to do with things like incremental compilation, &c. There might be sections of code unused in the larger binary. This shouldn't happen for Release builds, though.
Joey 13.10.2009 15:32:27