Skip to content
Merged
Prev Previous commit
Enable GitVersionTask for F# exe projects
For F# projects the generated AssemblyInfo and GitVersionInformation fs files
are added before already included source files using
CompileBefore Include instead of Compile Include.

This is done in two ItemGroups with a F# condition on the
language property.
  • Loading branch information
Daniel Hegner committed Nov 7, 2019
commit 5e43bd793f628709f5298c77e9c228636e3e2fd7
14 changes: 10 additions & 4 deletions src/GitVersionTask/build/GitVersionTask.targets
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
<Output TaskParameter="AssemblyInfoTempFilePath" PropertyName="AssemblyInfoTempFilePath" />
</UpdateAssemblyInfo>

<ItemGroup>
<ItemGroup Condition="'$(Language)' == 'F#'">
<CompileBefore Include="$(AssemblyInfoTempFilePath)" />
</ItemGroup>
<ItemGroup Condition="'$(Language)' != 'F#'">
<Compile Include="$(AssemblyInfoTempFilePath)" />
</ItemGroup>

Expand All @@ -44,14 +47,17 @@
<Output TaskParameter="GitVersionInformationFilePath" PropertyName="GitVersionInformationFilePath" />
</GenerateGitVersionInformation>

<ItemGroup>
<ItemGroup Condition="'$(Language)' == 'F#'">
<CompileBefore Include="$(GitVersionInformationFilePath)" />
<FileWrites Include="$(GitVersionInformationFilePath)" />
</ItemGroup>
<ItemGroup Condition="'$(Language)' != 'F#'">
<Compile Include="$(GitVersionInformationFilePath)" />
<FileWrites Include="$(GitVersionInformationFilePath)" />
</ItemGroup>

</Target>

<Target Name="GetVersion" BeforeTargets="CoreCompile;GetAssemblyVersion;GenerateNuspec;_GenerateRestoreProjectSpec;_GetOutputItemsFromPack;EnsureWixToolsetInstalled" Condition="$(GetVersion) == 'true'">
<Target Name="GetVersion" BeforeTargets="CoreCompile;GetAssemblyVersion;GenerateNuspec;_GenerateRestoreProjectSpec;_GetOutputItemsFromPack;EnsureWixToolsetInstalled" Condition="$(GetVersion) == 'true'">

<GetVersion SolutionDirectory="$(GitVersionPath)" ConfigFilePath="$(GitVersionConfig)" NoFetch="$(GitVersion_NoFetchEnabled)">
<Output TaskParameter="Major" PropertyName="GitVersion_Major" />
Expand Down