【问题标题】:How to choose 32 or 64 bit DLLs while building my C# application with MSBuild?使用 MSBuild 构建 C# 应用程序时如何选择 32 位或 64 位 DLL?
【发布时间】:2018-10-18 00:10:04
【问题描述】:

我有一个运行 64 位 DLL 的应用程序分支。我现在找到了这些相同库的 32 位等效 DLL。我如何告诉 MSBuild 根据我是要为 32 位还是 64 位平台构建应用程序来使用某个 DLL?

恐怕我什至不知道从哪里开始。我看过也许在 MSBuild 中使用 PropertyGroup 项,但它没有多大意义......

【问题讨论】:

    标签: msbuild


    【解决方案1】:

    您想根据您的项目目标平台引用不同的 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

    【讨论】:

      猜你喜欢
      • 2013-04-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-17
      • 1970-01-01
      • 2012-06-06
      • 1970-01-01
      相关资源
      最近更新 更多