问题描述
在我的 C++ Visual Studio 解决方案中,一个项目Proxy"为 Win32 构建生成一个 Proxy.dll,为 x64 构建生成一个 Proxy64.dll.现在我想添加一个需要 Proxy.dll 和 Proxy64.dll 构建的实用程序项目.如果我设置依赖项,根据当前的解决方案平台目标,我只会得到其中之一.有没有办法指定某个目标依赖于另一个项目的多个构建?
In my c++ visual studio solution one project "Proxy" generates a Proxy.dll for Win32 build and Proxy64.dll for x64 build. Now I want to add a Utility project that requires that both Proxy.dll and Proxy64.dll builds. If I set up dependencies I get only one of them depending on current solution platform target. Is there a way to specify that some target depends on multiple builds of another project?
推荐答案
假设您的解决方案的其余部分是 x64,您可以在Project"标签内添加以下内容:
Assuming the rest of your solution is x64, you can add the following inside the "Project" tags:
<Project>
<Target Name="AfterBuild">
<MSBuild Condition=" '$(Platform)' == 'x64' "Projects="$(MSBuildProjectFile)" Properties="Platform=Win32;PlatFormTarget=Win32" RunEachTargetSeparately="true" />
</Target>
</Project>
如果解决方案的其余部分是 Win32,那么您将在 MSBuild 条件行内编辑适当的值.
If the rest of the solution is Win32, then you would edit the appropriate values inside the MSBuild condition line.
这篇关于使目标需要 32 位和 64 位版本的 dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!