-
-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathDirectory.Build.targets
More file actions
56 lines (50 loc) · 2.59 KB
/
Directory.Build.targets
File metadata and controls
56 lines (50 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<!--
This file allows overriding of properties for all projects in the directory.
See
https://learn.microsoft.com/en-us/visualstudio/msbuild/customize-by-directory?view=vs-2022#directorybuildprops-and-directorybuildtargets
-->
<Project>
<PropertyGroup>
<_BuildProjBaseIntermediateOutputPath>$(MSBuildThisFileDirectory)build/obj/</_BuildProjBaseIntermediateOutputPath>
<_DotnetToolManifestFile>$(MSBuildThisFileDirectory).config/dotnet-tools.json</_DotnetToolManifestFile>
<_DotnetToolRestoreOutputFile>
$(_BuildProjBaseIntermediateOutputPath)/dotnet-tool-restore-$(NETCoreSdkVersion)-$(OS)</_DotnetToolRestoreOutputFile>
<_DotnetFantomasOutputFile>
$(BaseIntermediateOutputPath)dotnet-fantomas-msbuild-$(NETCoreSdkVersion)-$(OS)</_DotnetFantomasOutputFile>
</PropertyGroup>
<!-- Make sure that dotnet tools are restored before restoring any project -->
<Target Name="ToolRestore" BeforeTargets="Restore;CollectPackageReferences"
Inputs="$(_DotnetToolManifestFile)" Outputs="$(_DotnetToolRestoreOutputFile)">
<Exec Command="dotnet tool restore" WorkingDirectory="$(MSBuildThisFileDirectory)"
StandardOutputImportance="High" StandardErrorImportance="High" />
<MakeDir Directories="$(_BuildProjBaseIntermediateOutputPath)" />
<Touch Files="$(_DotnetToolRestoreOutputFile)" AlwaysCreate="True" ForceTouch="True" />
<ItemGroup>
<FileWrites Include="@(_DotnetToolRestoreOutputFile)" />
</ItemGroup>
</Target>
<!-- Make sure that files are formatted before building -->
<Target Name="FormatFSharp"
Condition=" '$(MSBuildProjectExtension)' == '.fsproj' AND '$(DesignTimeBuild)' != 'true' "
Inputs="@(Compile)" Outputs="$(_DotnetFantomasOutputFile)">
<Exec Command="dotnet fantomas $(MSBuildProjectDirectory)" StandardOutputImportance="Normal"
StandardErrorImportance="High" WorkingDirectory="$(MSBuildThisFileDirectory)"
ContinueOnError="WarnAndContinue" />
<Touch Files="$(_DotnetFantomasOutputFile)" AlwaysCreate="True" ForceTouch="True" />
<ItemGroup>
<FileWrites Include="@(_DotnetFantomasOutputFile)" />
</ItemGroup>
</Target>
<!-- Only format once per project -->
<!-- https://learn.microsoft.com/en-us/visualstudio/msbuild/run-target-exactly-once?view=vs-2022 -->
<Target Name="FormatFSharpBeforeOuterBuild"
DependsOnTargets="FormatFSharp"
BeforeTargets="DispatchToInnerBuilds"
/>
<Target Name="FormatFSharpBeforeInnerBuild"
BeforeTargets="BeforeBuild">
<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="FormatFSharp"
RemoveProperties="TargetFramework" />
</Target>
</Project>