Reason why a VS 2008 project is being rebuilt each time

南楼画角 提交于 2019-12-12 09:05:52

问题


Is there a way to find out the reason why a project is being rebuilt each time a Build Selection operation is issued in VS 2008?

I've tried to even remove all dependencies from the Build\Configuration Manager (unchecked the build column for all assemblies, but the one in question).

I get the same result: the assembly is rebuilt each time.

I have to mention that all the dependencies are built in the same directory (there is a common Output Directory).

Actually it's not very clear to me what is the VS/MSBuild algorithm to decide whether a project should be rebuilt or not. Does it check to see whether there are dependencies (files/assemblies) that have the Last Access NTFS timestamp newer than the one on the assembly in question? Maybe I could try to search for the "offending" file this way.


回答1:


Do you have a Prebuild action defined that updates some of your input files? Also a custom build step that is always triggerd might be the reason.

What kind of project type do you have?




回答2:


Is there a circular dependency between different modules/projects in your application?




回答3:


If you are modifying the AssemblyInfo.cs with an updated AssemblyFileVersion (As I do with Cruise Control .Net) for example I've found that it forces a rebuild.




回答4:


This can be caused by MSVC 2008 mis-handling (recently added) pre-build rules. Do a clean, close MSVC, delete .pch and .ncb files, reopen MSVC and build. This should fix the unnecessary compilation.




回答5:


I am not 100% sure, but it appears projects with any warnings will always be rebuilt.




回答6:


I have not found the root cause of the problem, but have found a way to get rid of the effects:

GetLatestVersion (with the "overwrite existing" option).

Everything is ok now.

One more thing that I found out, unfortunately after I have overwritten the local project files with the Workspace version: there is an option in Tools-Options-Projects and Solution-Build and Run-MSBuild project build output verbosity.

This option is set to Minimal by default. If set on Detailed or Diagnostic will log a lot of interesting messages in the Output Window when compiling a project. It may have given me pointers as to why the project was being compiled each time.



来源:https://stackoverflow.com/questions/1486628/reason-why-a-vs-2008-project-is-being-rebuilt-each-time

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