-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCommon.Docs.props
51 lines (42 loc) · 1.82 KB
/
Common.Docs.props
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
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
This file contains all the shared properties for
the docs projects that are in this solution
-->
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<Target Name="BuildDocs" AfterTargets="AfterBuild" BeforeTargets="PostBuildEvent">
<!-- Prevent parallel execution -->
<PropertyGroup>
<BuildDocInParallel>false</BuildDocInParallel>
</PropertyGroup>
<!-- Check if docfx.json exists -->
<PropertyGroup>
<DocFxConfigExists Condition="Exists('docfx.json')">true</DocFxConfigExists>
</PropertyGroup>
<!-- Only proceed if docfx.json exists -->
<Message Text="docfx.json not found. Skipping documentation generation."
Condition="'$(DocFxConfigExists)' != 'true'"/>
<CallTarget Targets="ExecuteBuildDocs"
Condition="'$(DocFxConfigExists)' == 'true'"/>
</Target>
<Target Name="ExecuteBuildDocs">
<!-- Restore tools with error handling -->
<Exec Command="dotnet tool restore"
ContinueOnError="false"
StandardOutputImportance="low"
StandardErrorImportance="high"/>
<!-- Clean output directories -->
<RemoveDir Directories="_site;api"/>
<!-- Generate and build documentation -->
<Exec Command="dotnet docfx metadata docfx.json"
ContinueOnError="false"
StandardOutputImportance="normal"
StandardErrorImportance="high"/>
<Exec Command="dotnet docfx build docfx.json --warningsAsErrors"
ContinueOnError="false"
StandardOutputImportance="normal"
StandardErrorImportance="high"/>
</Target>
</Project>