Visual Studio C# projects force a rebuild when switching from debug to release and vice-versa

浪尽此生 提交于 2019-12-05 05:30:10

I admit i've never paid much attention to it, but i tried just for curiosity (Visual Studio 2012 Update 4).

With a single project like you described, i tried switching configurations, and appearently, when i change the configuration, the main project builds again:

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

But if i look at the output folder, no file is being updated (the changed time of each file it's the same as the previous build), except for the vshost.exe (i disabled it, but got the same message). I tried then to set the build log to be more verbose (Tools - Options Projects and Solutions - build and Run - MSBuild project build output verbosity - Change from "Minimal" to "Normal" or "Detailed"):

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 doesn't really get rebuilded every time. If you find instead that everything gets rebuilded (check the changed time on output dir files), then try to increase the build log verbosity as i described and see what is happening. Hope it helps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!