We have run into an issue where we have multiple solutions that use common projects will rebuild the project even though it was just built. FooProject and BarProject both have Service References (not sure if this is pertinent information). MobileProject and SecurityProject do not have service references. The issue that we are seeing is that if you open TestA.sln, change the configuration to Release a file build.force will appear in the obj/release folder.
TestA.sln and TestB.sln have the exact same 4 projects - FooProject, BarProject, MobileProject, and SecurityProject (for testing purposes obviously)
Here are the steps we take to reproduce the issue:
- Open TestA.sln in VS 2017
- Switch to Release configuration
- Build
- Close VS
- Wait a minute or 2
- Open TestB.sln in VS2017
- Switch to Release configuration (the force.build file appears in FooProject\bin\x86\Release and BarProject\bin\x86\Release)
- Build Close VS
- Open FooProject\bin\x86\Release. Notice how FooProject.dll and BarProject.dll were recompiled when you built TestB.sln
These repro steps are not valid in VS2015. This issue only occurs in VS2017.
If you delete the build.force file after switching to release but before building then the project won't rebuild. If you leave it the with Diagnostic build output enabled you will see a message like
Project 'FooProject' is not up to date. Last build was with unsaved files.
As far as I can tell the build.force file is a way to force a build by creating a file that was not included in the last build. Why is this happening only in VS2017? Why is it assuming that it needs to build at all?
Additional details:
I have a workaround to the above repro steps. If I open TestA.sln -> Release -> Build. Then Open TestB.sln -> close VS 2017 -> Open TestB.sln -> Release -> Build. Now the solution will properly not build any projects.
I don't believe that this has to do with circular references. I have cleared all references and re-added them without warning. The Build order seems to be fine as it builds in order of dependence (only 4 projects, pretty easy to see).