1

For an F# project with dual platforms "Xbox 360" and "x86," I have the following in my project file:

<ItemGroup Condition="'$(Platform)' == 'Xbox 360'">
    <Reference Include="Arands.ContentTracker.Xbox">
     <HintPath>..\..\..\..\..\..\_Libs\XNA\ContentTracker\ContentTracker\bin\Xbox 360\Release\Arands.ContentTracker.Xbox.dll</HintPath>
    </Reference>
</ItemGroup>
<ItemGroup Condition="'$(Platform)' == 'x86'">
    <Reference Include="Arands.ContentTracker">
    <HintPath>..\..\..\..\..\..\_Libs\XNA\ContentTracker\ContentTracker\bin\x86\Release\Arands.ContentTracker.dll</HintPath>
    </Reference>
</ItemGroup>

For some reason, neither Arands.ContentTracker.dll nor Arands.ContentTracker.Xbox.dll are added as references in my project, regardless of which platform I select (Xbox 360 or x86).

The result is the same with the following:

<Reference Condition="'$(Platform)' == 'Xbox 360'" Include="Arands.ContentTracker.Xbox">
    <HintPath>..\..\..\..\..\..\_Libs\XNA\ContentTracker\ContentTracker\bin\Xbox 360\Release\Arands.ContentTracker.Xbox.dll</HintPath>
</Reference>
<Reference Condition="'$(Platform)' == 'x86'" Include="Arands.ContentTracker">
    <HintPath>..\..\..\..\..\..\_Libs\XNA\ContentTracker\ContentTracker\bin\x86\Release\Arands.ContentTracker.dll</HintPath>
</Reference>

Is the Condition attribute simply ignored in .fsproj files?

Splitting a project in two sucks. I want the current chosen platform to determine the current configuration and what goes on in a build, not (for example) which project tree I had expanded when I double-clicked a .fs code file in the Solution Explorer. Having multiple projects just to accommodate different platforms has caused me some fairly significant headaches, and even confuses Intellisense (e.g. not identifying System.Collections.Generic.HashSet as unavailable when my platform is set to Xbox 360).

UPDATE: I've managed to get it working. My mistake was expecting the Solution Explorer to reflect a change in configuration, e.g. for the References in the F# project to actually show the relevant references, as I'm used to seeing for C# projects with conditional tags. Apparently, F# projects simply display nothing in the References section when there are conditionals involved (unfortunately).

Once I got past the assumption that the Solution Explorer would accurately reflect the relevant assets after a platform change, I was able to focus on other areas of the solution (namely, the Configuration Manager and References to the F# project in the C# projects) that required more attention.

Thanks for your assistance, all! I'd prefer to award the points to Preet Sangha, since it was his question that provided the insight that allowed me to get past the aforementioned assumption.

4

1 回答 1

2

msbuild -v:diag ...这应该只是一个 MSBuild 的事情,并且应该可以工作......运行以诊断出了什么问题可能很有用;也许项目文件中的内容顺序错误?

于 2012-08-12T22:28:41.027 回答