【发布时间】:2018-10-18 00:10:04
【问题描述】:
我有一个运行 64 位 DLL 的应用程序分支。我现在找到了这些相同库的 32 位等效 DLL。我如何告诉 MSBuild 根据我是要为 32 位还是 64 位平台构建应用程序来使用某个 DLL?
恐怕我什至不知道从哪里开始。我看过也许在 MSBuild 中使用 PropertyGroup 项,但它没有多大意义......
【问题讨论】:
标签: msbuild
我有一个运行 64 位 DLL 的应用程序分支。我现在找到了这些相同库的 32 位等效 DLL。我如何告诉 MSBuild 根据我是要为 32 位还是 64 位平台构建应用程序来使用某个 DLL?
恐怕我什至不知道从哪里开始。我看过也许在 MSBuild 中使用 PropertyGroup 项,但它没有多大意义......
【问题讨论】:
标签: msbuild
您想根据您的项目目标平台引用不同的 dll(不同的路径/名称)吗?使用条件,类似这样:
<ItemGroup>
<Reference Include="Dependency.dll" Condition="$(Platform) == 'x64'">
<HintPath>x64\Dependency.dll</HintPath>
</Reference>
<Reference Include="Dependency.dll" Condition="$(Platform) == 'x86'">
<HintPath>x86\Dependency.dll</HintPath>
</Reference>
<ItemGroup>
另请参阅:How do I specify the platform for MSBuild? 和 Active solution platform VS Project Platform VS Platform target。
【讨论】: