Originally we found this problem in complex solution, but now I can reproduce it on dummy project too.
If I create project in VS2012 premium (update 4) and add Fakes assembly for one of the references, it seems that project will always rebuild regardless of anything being changed. I.e. I build the project then clicking the build button again will result in rebuilding the project.
Turning on diagnostic build info, it seems that root cause of the problem is that tool compiling the .fakes file is touching the .Fakes.dll file, hence VS thinks that something has changed:
1>Using "Touch" task from assembly "Microsoft.Build.Tasks.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
1>Task "Touch" (TaskId:11)
1> Task Parameter:
1> Files=
1> D:\work\Ch24_2014_PreEC\UnitTestProject1\FakesAssemblies\mscorlib.4.0.0.0.Fakes.dll
1> D:\work\Ch24_2014_PreEC\UnitTestProject1\FakesAssemblies\System.4.0.0.0.Fakes.dll
1> D:\work\Ch24_2014_PreEC\UnitTestProject1\FakesAssemblies\mscorlib.4.0.0.0.Fakes.fakesconfig
1> D:\work\Ch24_2014_PreEC\UnitTestProject1\FakesAssemblies\System.4.0.0.0.Fakes.fakesconfig (TaskId:11)
1> Touching "D:\work\Ch24_2014_PreEC\UnitTestProject1\FakesAssemblies\mscorlib.4.0.0.0.Fakes.dll". (TaskId:11)
1> Touching "D:\work\Ch24_2014_PreEC\UnitTestProject1\FakesAssemblies\System.4.0.0.0.Fakes.dll". (TaskId:11)
1> Touching "D:\work\Ch24_2014_PreEC\UnitTestProject1\FakesAssemblies\mscorlib.4.0.0.0.Fakes.fakesconfig". (TaskId:11)
1> Touching "D:\work\Ch24_2014_PreEC\UnitTestProject1\FakesAssemblies\System.4.0.0.0.Fakes.fakesconfig". (TaskId:11)
1>Done executing task "Touch". (TaskId:11)
[...]
1>Input file "D:\work\Ch24_2014_PreEC\UnitTestProject1\FakesAssemblies\System.4.0.0.0.Fakes.dll" is newer than output file "obj\Debug\UnitTestProject1.pdb".
Please advise on what am I doing wrong and how to get around this, so that the project would not rebuild redundantly all the time.
Thanks in advance
Edited
For clarification, here are the steps to reproduce the problem:
Note that you don't have to add a single line of code to the solution.
Try to edit registry settings of visual studio. Set "U2DCheckVerbosity"=dword:00000001
at [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\General]
Then you will see in output, why visual studio thinks, full rebuild is neccessary. Original info is here.
[UPDATE]
Things changed slightly for vs2017, instructions are here
To manually update the "fast up-to-date check" registry setting in VS 2017, do the following:
- Close VS 2017 and wait 20-30 seconds for it to release its private registy hive.
- Run regedit.exe
- Select HKEY_LOCAL_MACHINE File --> Load Hive...
- Go to folder %LOCALAPPDATA%\Microsoft\VisualStudio
- Select the 15.0_* folder that does not end with Exp
- Select the privateregistry.bin file in that folder. For example, C:\Users\MyUserName\AppData\Local\Microsoft\VisualStudio\15.0_4eff8961\privateregistry.bin
- For Load Hive's Key Name just make up a name like VSTweak
The hive should now appear as HKEY_LOCAL_MACHINE\VSTweak.
- Edit (or add) the U2DCheckVerbosity dword (32-bit) value to 1 (or 0 to disable) under: HKEY_LOCAL_MACHINE\VSTweak\Software\Microsoft\VisualStudio\15.0_4eff8961\General
- Select the hive root node (e.g., VSTweak)
- File --> Unload Hive...
- Confirm unloading the hive.
- Start VS and build stuff.
Get messages that indicate problems like: Project 'Common' is not up to date. Error (0x8000FFFF).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With