Mladen Prajdić Blog

Blog about stuff and things and stuff. Mostly about SQL server and .Net

Why would Visual Studio build always rebuild a solution?

Today I had an interesting problem.

If I rebuilt my solution every thing would succeed but after that if i pressed F5 (build) the whole solution would get built again but it would error out. Now this doesn’t make any sense because the difference between Build and Rebuild is that Rebuild always compiles and links all files + all dependencies, while Build only compiles and links files that have changed since the last build. So everything should be fine. The thing about our solution is that the we have some post build events that do some IL merge, etc… the problem was that rebuild ran those events while just build didn’t. So on build IL merge didn’t happen and I got the error when I pressed F5.

It turned out that one dependant DLL that was included everywhere had a create date set to year 2049 and because of that the build process wanted to build everything every time since it thought that it had changed since it was in the future. Talk about going back to the future :)

 

Moral of the story: If your build always builds your whole solution check for future dated files.

 

kick it on DotNetKicks.com