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
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.
精彩评论