It seems Visual Studio 2012 C# projects force a rebuild every time you switch from Debug to Release or vice-versa, even if nothing has changed in the project. This does not happen for a standalone project -- but if you add a single project reference to a class library it starts exhibiting the behavior every time you change to a different build configuration. I've tracked it down to the generation of the force.build
file (in obj\Debug
or obj\Release
) whenever the configuration selection changes. Why is this? Can it be disabled? I would think that switching configurations should not in and of itself require a rebuild. I cannot find any mention of the "force.build" file and/or how to disable this "feature" in any documentation.
To recreate the issue:
- Click
File
/New Project...
- Create a new
Visual C#
->Console Application
. Leave the generated code as-is. - Right-click on the new solution in the solution explorer and select
Add
->New Project...
- Choose
Visual C#
->Class Library
. Leave the generated code as-is. - Right-click on the
ConsoleApplication1
in the solution explorer and selectAdd Reference...
- Check the box next to
ClassLibrary1
inSolution
->Projects
and hitOK
. - Build the project in
Debug
configuration. It builds, as expected. - Switch to
Release
configuration and build again. It builds, as expected. - Switch back to
Debug
and build again. It builds, and it shouldn't. It's already been built, right? All we did was change the target configuration selection.
Is this a bug? Is there a workaround?