【发布时间】:2015-02-19 04:48:41
【问题描述】:
我在一个解决方案中有几个 dll 项目(有些相互依赖)
Project1 -> Properties -> Linker -> Input -> Additional Dependencies -> Project2.lib
Project1 -> Properties -> Linker -> General -> Additional Library Directories -> $(OutDir)
一切正常。
项目是 Win7Debug Win32、Win7Debug x64..... 以及只有 Debug 和 Release 配置的 Win32 项目。
我希望将 Win32 的所有 dll 放在一个文件夹中,将 x64 的 dll 放在另一个文件夹中。所以我为Win32项目添加了x64配置,并改变了
Project1 -> Properties -> Linker -> General -> Output File -> $(SolutionDir)/i386/$(TargetName)/$(TargetExt)
(对于 Win32 - x64 的类似更改)
一切似乎都很好 - 我只收到 i386 文件夹中的 dll ......直到我不得不重建并得到 p>
Warning 23 warning MSB8012:
TargetPath(C:\Path\Win7Debug\Project1.dll) does not match the Linker's OutputFile
property value (C:\Path\i386\Project1.dll). This may cause your project to build
incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and
$(TargetExt) property values match the value specified in %(Link.OutputFile).
这似乎很严重......而且我不想遇到缺少依赖项的问题(尽管一切似乎都运行良好 - 而不仅仅是在我的机器上)
我变了
Project1 -> Properties -> Configuration Properties -> General -> OutputDirectory -> $(SolutionDir)/i386
(以匹配链接器输出)但现在我当然会在与 dll 相同的文件夹中获取 lib 和 exp 文件。
除了使用后期构建脚本之外,有没有办法分离输出文件?
我是否应该保留原来的设置并忽略上面的警告?
注意:我不是要分离平台/配置输出文件...这是使用默认输出目录自动完成的。
我需要的是,对于每个平台,只将 DLL 文件放在一个文件夹中,远离其他任何东西。重定向链接器输出(并将项目输出保留为标准)可以实现这一点 - 我只是不确定它是否正确。从逻辑上讲,我不应该有任何构建问题,因为我正在向链接器提供它需要的所有信息......
【问题讨论】:
-
我接受了下面的答案,因为 - 虽然从 dll 中分离 lib 似乎没有任何副作用 - 使用 Visual Studio 提供的默认值似乎更好,依赖项明显旁边需要的dll。并让下游应用过滤输入。