Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio / MSBUILD does not update .lib files when sources are updated

I have a Visual Studio solution with a library project let's call it libFoo, and an executable project - let's call it Bar which depends on libFoo.

When I change, for example, libFoo/bar.cpp and attemp to build libFoo then Visual Studio compiles my bar.cpp file, but does not re-generate the library libFoo.lib, saying that it is already up to date.

I checked the system clock. I also verified that the modification time of the bar.obj file is actually updated and that the library is older than the obj. But it still does not re-create the library.

The actual solution actually consists of around 100 projects, some of them are libraries and some of them are executables. The problem happens on the computers of 3 of my team members. The rest are unaffected. We have no idea why it happens, and how to fix it... or weather it might happen to the other team memebers.

I were not able to re-produce it by creating my own small solution with a library and an executable that depends on it. So I believe that this is some combination of an environment problem and a problem with our solution/project files.

Thanks, Alex.

Edit

The solution was created on Visual Studio 2010 and developed on VS2010 for the past years, until we started using VS2012. The problem happens for users having both VS2010 and VS2012 installed. The solution is a VS2012 solution now, and the projects use the VS2010 platform toolkit.

When we started using VS2012, our team migrated the solution but we left the "platform toolkit" for all the C++ projects to be that of VS2010, to allow compatibility of our code with the other teams still using VS2010.

Google did not reveal any plausible solution. Although it did reveal the fact that other people also encountered similar problems.

like image 633
Alex Shtof Avatar asked Jan 29 '13 13:01

Alex Shtof


1 Answers

It seems that we have encountered the same problem as the person who asked this question. There is also a bug report on Microsoft Connect.

To make things short - our intermediate folder was the same as our %temp% folder on some configurations. We solved the problem by modifying the intermediate folder of all our Visual C++ projects.

like image 90
Alex Shtof Avatar answered Nov 08 '22 21:11

Alex Shtof