Question from Eric Wilson:

Could you do a post on what the settings on the Advanced Tab in Visual Studio.Net for C# projects are for and when you should use them?

My lame response:

I've only occasionally had to deal with the project-system guys that more or less own that 'Tab", so I can't even remember what's on it.  Going off of the online MSDN: Visual C# Reference Advanced, Configuration Properties, <Projectname> Property Pages Dialog Box, I see 4 settings:

  • Incremental Build - don't use it unless you absolutely need to.  It's getting removed in future versions.  It was a buggy attempt at trying to only recompile changed code and thus speed up compilation.
  • Base Address - For Class Libraries (DLLs) you can get a small speedup in load times if the OS doesn't have to relocate your DLL from it's preferred base address.  This is a big thing for native DLLs which typically have hundreds of relocations.  For managed DLLs there's at most one: the import of mscoree.dll!_CorDllMain.  As such this isn't really a huge win, but possibly still measurable.  It will also impact working-set across multiple processes.  Of course most big software houses don't use this setting, instead they run a tool like rebase.exe as a post-build step that lays out all of the DLLs so they all get unique addresses. [More info in a new post]
  • File Alignment - For certain binaries, this enables you to save a little extra file space.  The 2 most common values are 4096, and 512.  I think the default is 4096.  By setting it to 512 you can potentially reduce the ammount of file padding, but this can hurt performance in other scenarios because now each section is not aligned the same as a memory page.  As with all performance issues, the best advice is to try it out and measure.  I expect this would have a bigger impact on the Compact Frameworks than on desktop applications.
  • Do not Use Mscorlib - The C# compiler automatically includes a reference to the mscorlib.dll that is installed with the current runtime.  If you want to use a different mscorlib.dll, you need to us this setting to disable the automatic reference, otherwise the 2 will conflict.  The most common use would be the Compact Frameworks.


[12/29/04 - added link to new post on base addresses]