Visual Studio 2010 always thinks project is out of

2018-12-31 23:44发布

I have a very similar problem as described here.

I also upgraded a mixed solution of C++/CLI and C# projects from Visual Studio 2008 to Visual Studio 2010. And now in Visual Studio 2010 one C++/CLI project always runs out of date.

Even if it has been compiled and linked just before and F5 is hit, the messagebox "The project is out of date. Would you like to build it?" appears. This is very annoying because the DLL file is very low-tiered and forces almost all projects of the solution to rebuild.

My pdb settings are set to the default value (suggested solution of this problem).

Is it possible the get the reason why Visual Studio 2010 forces a rebuild or thinks a project is up to date?

Any other ideas why Visual Studio 2010 behaves like that?

27条回答
一个人的天荒地老
2楼-- · 2018-12-31 23:53

There are quite a few potential reasons and - as noted - you need to first diagnose them by setting MSBuild verbosity to 'Diagnostic'. Most of the time the stated reason would be self explanatory and you'd be able to act on it immediatelly, BUT occasionally MSBuild would erroneously claim that some files are modified and need to be copied.

If that is the case, you'd need to either disable NTFS tunneling or duplicate your output folder to a new location. Here it is in more words.

查看更多
唯独是你
3楼-- · 2018-12-31 23:53

The .NET projects are always recompiled regardless. Part of this is to keep the IDE up to date (such as IntelliSense). I remember asking this question on an Microsoft forum years ago, and this was the answer I was given.

查看更多
笑指拈花
4楼-- · 2018-12-31 23:54

I had a similar issue with Visual Studio 2005, and my solution consisted of five projects in the following dependency (first built at top):

Video_Codec depends on nothing
Generic_Graphics depends on Video_Codec
SpecificAPI_Graphics depends on Generic_Graphics
Engine depends on Specific_Graphics
Application depends on Engine.

I was finding that the Video_Codec project wanted a full build even after a full clean then rebuild of the solution.

I fixed this by ensuring the pdb output file of both the C/C++ and linker matched the location used by the other working projects. I also switched RTTI on.

查看更多
唯独是你
5楼-- · 2018-12-31 23:55

In Visual Studio 2012 I was able to achieve the same result easier than in the accepted solution.

I changed the option in menu ToolsOptionsProjects and SolutionsBuild and Run → *MSBuild project build output verbosity" from Minimal to Diagnostic.

Then in the build output I found the same lines by searching for "not up to date":

Project 'blabla' is not up to date. Project item 'c:\foo\bar.xml' has 'Copy to Output Directory' attribute set to 'Copy always'.

查看更多
呛了眼睛熬了心
6楼-- · 2018-12-31 23:55

Visual Studio 2013 -- "Forcing recompile of all source files due to missing PDB". I turned on detailed build output to locate the issue: I enabled "Detailed" build output under "Tools" → "Projects and Solutions" → "Build and Run".

I had several projects, all C++, I set the option for under project settings: (C/C++ → Debug Information Format) to Program Database (/Zi) for the problem project. However, this did not stop the problem for that project. The problem came from one of the other C++ projects in the solution.

I set all C++ projects to "Program Database (/Zi)". This fixed the problem.

Again, the project reporting the problem was not the problem project. Try setting all projects to "Program Database (/Zi)" to fix the problem.

查看更多
唯独是你
7楼-- · 2018-12-31 23:56

If you change the Debugging Command arguments for the project, this will also trigger the project needs to be rebuilt message. Even though the target itself is not affected by the Debugging arguments, the project properties have changed. If you do rebuild though, the message should disappear.

查看更多
登录 后发表回答