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楼-- · 2019-01-01 00:01

I'm using Visual Studio 2013 Professional with Update 4 but didn't find resolution with any of the other suggestions, however, I did manage to resolve the issue for my Team project.

Here's what I did to cause the problem -

  • Created a new class object (Project -> Add Class)
  • Renamed the file via Solution Explorer and clicked yes when asked if I wanted to automatically rename all references to match

Here's what I did to solve the problem -

  • Go to Team Explorer Home
  • Click Source Control Explorer
  • Drill into the folder where all of the class/project files are
  • Found the ORIGINAL filename in the list and deleted it via right-click
  • Build

If this is the case for you then just be extra sure that you're deleting the phantom file rather than the actual one you want to keep in the project.

查看更多
看淡一切
3楼-- · 2019-01-01 00:07

For me, the problem arose in a WPF project where some files had their 'Build Action' property set to 'Resource' and their 'Copy to Output Directory' set to 'Copy if newer'. The solution seemed to be to change the 'Copy to Output Directory' property to 'Do not copy'.

msbuild knows not to copy 'Resource' files to the output - but still triggers a build if they're not there. Maybe that could be considered a bug?

It's hugely helpful with the answers here hinting how to get msbuild to spill the beans on why it keeps building everything!

查看更多
千与千寻千般痛.
4楼-- · 2019-01-01 00:09

I don't know if anyone else has this same problem, but my project's properties had "Configuration Properties" -> C/C++ -> "Debug Information Format" set to "None", and when I switched it back to the default "Program Database (/Zi)", that stopped the project from recompiling every time.

查看更多
登录 后发表回答