0

After consecutive builds of a solution without making any changes to an assembly's code or any of its referenced assemblies' code, I've noticed that new DLLs are not compiled in the build folder (ie, the DLLs still have the old date and time). However, if I make any code changes and then do a build of the solution, new DLLs are written.

I've also discovered that doing a rebuild (as opposed to a standard build) does force VS to compile new DLLs. Cleaning the solution and doing a standard build also causes this.

About my initial issue of new DLLs not being compiled on a standard rebuild: is this by design? It's not a problem as I can just create a macro that does a rebuild and assign it to CTRL+SHIFT+ALT+B, but I would like to know for peace of mind due to some issues that have occurred with past deployments that have pointed the correct DLLs potentially not being properly copied over to the production servers.

oscilatingcretin
  • 10,457
  • 39
  • 119
  • 206
  • Feature, not a bug. There's no point in rebuilding DLLs if their code hasn't changed. – Hans Passant Aug 14 '11 at 16:19
  • 1
    You don't need to create a macro for this. You can bind any menu item to a keyboard shortcut using the Options dialog. But like Hans says, there's no point. The less you compile, the less time it takes to do the compile. – Cody Gray - on strike Aug 14 '11 at 16:24
  • +1 for the keyboard shortcut/menu option binding. I just tried it and it works! I won't be forcing a rebuild regularly, though. I'd just do it for official deployments so everyone can rest assured that the current DLLs have been built and copied to the production servers. When I do a deployment on Tuesday, but they still see DLLs dated on Monday, it comes to question whether or not the current DLLs have been copied. – oscilatingcretin Aug 14 '11 at 16:50

2 Answers2

2

It's behaving correctly. A "build" (as opposed to a "rebuild") only builds the things that have changed since the last build.

RichieHindle
  • 272,464
  • 47
  • 358
  • 399
2

You're seeing by-design behaviour. A Build command will only trigger a build of those projects in your solution whose source/settings have changed. Obviously used more often and saves time for the developer.

MSDN's How to Prepare and Manage Builds for Visual Studio 2005

Choose Build or Build Solution to compile only those project files and components that have changed since the last build.

More on Rebuild: Difference between Rebuild and Clean + Build in Visual Studio

Community
  • 1
  • 1
p.campbell
  • 98,673
  • 67
  • 256
  • 322
  • Good answer (and more detailed than RichieHindle's), but a minute too late, so I had to do what's right and give him the answer. I still voted you up, though. – oscilatingcretin Aug 14 '11 at 16:52