0

I have a unit test projects which requires some external dependencies. Those dependendies come in 2 flavors: i386 (........\External\EA\i386\Core.dll) and amd64 (........\External\EA\amd64\Core.dll).

  <ItemGroup>
    <Reference Include="Core">
      <HintPath>..\..\..\..\External\EA\amd64\Core.dll</HintPath>
    </Reference>
    <Reference Include="Util">
      <HintPath>..\..\..\..\External\EA\amd64\Util.dll</HintPath>
    </Reference>

MsTest is 32bits and I want the path of those assemblies to be ........\External\EA**i386**\Core.dll. In other words, how to I tell msbuild to pick the right build target.

Thanks

Martin
  • 39,309
  • 62
  • 192
  • 278
  • Take a look here: http://stackoverflow.com/questions/1997268/how-to-reference-different-version-of-dll-with-msbuild – Mrchief Jul 26 '11 at 19:02

1 Answers1

0

Just put a condition on the references, or as shown below, on the ItemGroup containing them,

<ItemGroup
   Condition="'$(Platform)' == 'x64'">
   <Reference Include="Core">
      <HintPath>..\..\..\..\External\EA\amd64\Core.dll</HintPath>
   </Reference>
   <Reference Include="Util">
      <HintPath>..\..\..\..\External\EA\amd64\Util.dll</HintPath>
   </Reference>
</ItemGroup>
<ItemGroup
   Condition="'$(Platform)' == 'Win32'">
   <Reference Include="Core">
      <HintPath>..\..\..\..\External\EA\i386\Core.dll</HintPath>
   </Reference>
   <Reference Include="Util">
      <HintPath>..\..\..\..\External\EA\i386\Util.dll</HintPath>
   </Reference>
</ItemGroup>

You'll have to discovere exactly which values for $(Platform) your project is using, which a simple examination of the XML of the projects will show.

Brian Kretzler
  • 9,748
  • 1
  • 31
  • 28