25. Februar 2014

Visual Studio 2010 Projects Always Out of Date Solved by Changing the File Date

If your Developer Studio suddenly tells you, that your project is "out of date". If it keeps telling you, even though you rebuild all. If a simple F5 always pops the annoying "These projects are out of date" dialog box, then ...

... you probably ran into a bug that lets Visual Studio think, that a totally unrelated file on your disk is a dependency of your project(s). This file probably has been added to your disk recently and for unknown reasons Visual Studio regards it as dependency.

In my case its "C:\PROGRAMDATA\NVIDIA CORPORATION\DRS\NVDRSDB0.BIN" from a newly installed Nvidia driver. Other files have also been reported like "C:\PROGRAMDATA\SOPHOS\SOPHOS ANTI-VIRUS\CONFIG\CONFIG.BOPS".

There might be other reasons for this behavior, like missing header files. These can be resolved easily, by adding the missing file or removing it from the solution.

This article is about solving the case of "Visual Studio Project Out Of Date Because of Weird Dependency".

The standard way to solve this is to
1. find out which file claims to be newer than your project.
2. Exclude the offending file.

Step 1:
Enable Visual Studio debugging and check the log. Basically:
in
%ProgramFiles(x86)%\Microsoft Visual Studio\10.0\Common7\IDE\
after
</configSections>
insert

<system.diagnostics>
  <switches>
    <add name="CPS" value="4" />
  </switches>
</system.diagnostics>
Then use DgbView to get the log output.

Step 2:
There seem to be ways to exclude the file or folder from the list of dependencies. This can be done for each project or system wide (which is probably what you want).

I am not a fan of changing details in large XML config files with weak documentation and multiple possible insertion points of which only one works and the others make things worse, and which affects all projects.

But I still tried.

Unfortunately, I do not get these solutions to work. My project still wants to rebuild every time.

There is another solution: 

Just change the "modified" file date of the offending file.

I am using Attribute Changer to date the file back by 2 years (or whatever). Simple and works.

For the record: I download tools like Attribute Changer only from trusted software repositories. You should too. Do not download from the "homepage" of the program. Anyone can make a homepage and send you anything.

_happy_attributing()