.csproj's platform specific ItemGroup works for assembly references but not content includes?

北城以北 提交于 2019-12-04 22:41:34

We put the Condition attribute on the Reference element and that works fine. Perhaps the Condition attribute also needs to be added to the Content element? (Do you really need both the Reference element and the Content element?) For example:

<Reference Include="SomeLib" Condition="$(Platform)=='x86'">
  <HintPath>..\..\ThirdParty\SomeLib\clr4\x86\SomeLib.dll</HintPath>
  <Private>False</Private>
</Reference>
<Reference Include="SomeLib" Condition="$(Platform)=='x64' Or $(Platform)=='AnyCPU'">
  <HintPath>..\..\ThirdParty\SomeLib\clr4\x64\SomeLib.dll</HintPath>
</Reference>

So has this question been answered? If not, I would recommend switching the order of the ItemGroups and seeing if the opposite result is achieved (that it works in x64 but on x86 Visual Studio displays the wrong reference).

So this is 'only' a visual / display problem. Underneath builds do use the proper references etc, only VS2010 displays the wrong one. All good, just not visible.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!