Visual Studio C # projects force recovery when switching from debug to release and vice versa

It seems Visual Studio 2012 C # projects are forcing to 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 single project, but if you add one link to the project in the class library, it starts to behave every time you change a different assembly configuration. I tracked it until the force.build file was force.build (in obj\Debug or obj\Release ) whenever the configuration choice changes. Why is this? Can it be disconnected? I would think that switching configurations should not in themselves require reconnection. I can not find the mention of the file "force.build" and / or how to disable this "function" in any documentation.

To recreate the problem:

  • Click File / New Project...
  • Create a new Visual C# Console Application . Leave the generated code as is.
  • Right-click 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 ConsoleApplication1 in the Solution Explorer and select Add Reference...
  • Select the ClassLibrary1 checkbox in Solution Projects and click OK .
  • Create a project in the Debug configuration. He builds as expected.
  • Go to the Release configuration and build. He builds as expected.
  • Go back to Debug and create again. He is building, and it should not. It is already built, right? All we did was change the target configuration choice.

This is mistake? Is there a workaround?

+5
source share
1 answer

I admit that I never paid much attention to this, but I tried only for the sake of curiosity (Visual Studio 2012 Update 4).

With one project, as you described, I tried to switch configurations, and, oddly enough, when I change the configuration, the main project is built again:

 ========== Build: 1 succeeded, 0 failed, 1 up-to-date, 0 skipped ========== 

But if I look at the output folder, the file is not updated (the modification time of each file is the same as the previous assembly), with the exception of vshost.exe (I disabled it but received the same message), then I tried to set the build log to be more detailed (Tools - Options Projects and Solutions - build and Run - MSBuild project build output output verbosity - Change from "Minimum" to "Normal" or "Details"):

enter image description here

Then I got the following output:

 1>------ Build started: Project: ConsoleApplication1, Configuration: Release Any CPU ------ 1>Build started 06/10/2015 00:26:50. 1>GenerateTargetFrameworkMonikerAttribute: 1>Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files. 1>CoreCompile: 1>Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files. 1>_CopyAppConfigFile: 1>Skipping target "_CopyAppConfigFile" because all output files are up-to-date with respect to the input files. 1>CopyFilesToOutputDirectory: 1> ConsoleApplication1 -> c:\users\user\documents\visual studio 2012\Projects\ConsoleApplication1\ConsoleApplication1\bin\Release\ConsoleApplication1.exe 1> 1>Build succeeded. 1> 1>Time Elapsed 00:00:00.09 ========== Build: 1 succeeded, 0 failed, 1 up-to-date, 0 skipped ========== 

So, it seems that the project is not really being restored every time. If instead you find that everything will be restored (check the changed time on the dir output files), try increasing the volume of the build log, as I described, and see what happens. Hope this helps.

+2
source

Source: https://habr.com/ru/post/1232998/


All Articles