更新源时,Visual Studio/MSBUILD不会更新.lib文件 [英] Visual Studio / MSBUILD does not update .lib files when sources are updated

查看:97
本文介绍了更新源时,Visual Studio/MSBUILD不会更新.lib文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Visual Studio解决方案,其中一个库项目称为libFoo,而一个可执行项目-称为Bar,它取决于libFoo.

例如,当我更改libFoo/bar.cpp并尝试构建libFoo时,Visual Studio会编译我的bar.cpp文件,但不会重新生成库libFoo.lib,表示它已经是最新的.

我检查了系统时钟.我还验证了bar.obj文件的修改时间实际上已更新,并且该库早于obj.但是它仍然不会重新创建库.

实际的解决方案实际上包含大约100个项目,其中一些是库,一些是可执行文件.该问题发生在我的3位团队成员的计算机上.其余的不受影响.我们不知道为什么会发生这种情况,以及如何解决它……或者说其他团队成员可能会遇到这种情况.

我无法通过使用库和依赖于它的可执行文件创建自己的小型解决方案来重现它.因此,我认为这是环境问题和我们的解决方案/项目文件问题的某种组合.

谢谢, 亚历克斯.

修改

该解决方案是在Visual Studio 2010上创建的,并且在过去几年中是在VS2010上开发的,直到我们开始使用VS2012.对于同时安装了VS2010和VS2012的用户,会发生此问题.该解决方案现在是VS2012解决方案,并且项目使用VS2010平台工具包.

当我们开始使用VS2012时,我们的团队迁移了该解决方案,但我们将所有C ++项目的平台工具包"都保留为VS2010,以允许我们的代码与仍在使用VS2010的其他团队兼容.

Google没有透露任何可行的解决方案.尽管它确实揭示了其他人也遇到类似问题的事实.

解决方案

似乎我们遇到了与询问问题.还有一个在Microsoft Connect上="=" nofollow noreferrer>错误报告.

简而言之-在某些配置中,我们的中间文件夹与%temp%文件夹相同.我们通过修改所有Visual C ++项目的中间文件夹来解决了这个问题.

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.

解决方案

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.

这篇关于更新源时,Visual Studio/MSBUILD不会更新.lib文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆