I've got the following set up (uninteresting XML removed for brevity):
MyProject.fsproj
<Project ...>
<Import Project="MyTask.props" />
...
<ItemGroup>
<Compile Include="Program.fs" />
</ItemGroup>
</Project>
MyTask.props
<Project ...>
<UsingTask XXX.UpdateAssemblyInfo />
<Target Name="UpdateAssemblyInfo"
BeforeTargets="CoreCompile">
<UpdateAssemblyInfo ...>
<Output
TaskParameter="AssemblyInfoTempFilePath"
PropertyName="AssemblyInfoTempFilePath" />
</UpdateAssemblyInfo>
<ItemGroup>
<Compile Include="$(AssemblyInfoTempFilePath)" />
</ItemGroup>
</Target>
</Project>
The problem is that the ItemGroup added by MyTask.props is added last, despite being imported right at the very start of the project. I assume that this is because the ItemGroup is not actually imported then - it's added by when the task is run.
This isn't a good thing in F#, as file order is important - including the file at the end of the build list means it's impossible to build an EXE, for example (as the entrypoint must be in the last file).
Hence my question - is there a way for me to output an ItemGroup as part of a Target and have that generated ItemGroup be first?