Skip to content

Commit da4da8c

Browse files
committed
fix: enhance DocFX build target with improved logging and error handling
1 parent 8d4131a commit da4da8c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Yubico.YubiKey/src/Yubico.YubiKey.csproj

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,19 @@ limitations under the License. -->
157157

158158
<!-- DocFX build target runs after Release-build -->
159159
<Target Name="CheckDocFX">
160-
<Exec Command="docfx --version" EchoOff="true" ContinueOnError="true" StandardErrorImportance="High" StandardOutputImportance="High">
160+
<Exec Command="docfx --version" ContinueOnError="true">
161161
<Output TaskParameter="ExitCode" PropertyName="DocFXExists" />
162162
</Exec>
163163
<Error Condition="'$(DocFXExists)' != '0'" Text="DocFX is not installed. Please install it using: dotnet tool install --global docfx" />
164164
</Target>
165165

166166
<Target Name="DocFXBuild" AfterTargets="Build" DependsOnTargets="CheckDocFX" Condition="'$(Configuration)' == 'Release'">
167-
<Exec Command="docfx build $(MSBuildProjectDirectory)/docfx.json --log docfxlogz.txt" IgnoreExitCode="true"/>
167+
<Exec Command="docfx build $(MSBuildProjectDirectory)/docfx.json --logLevel warning --log docfx-log.txt --warningsAsErrors" IgnoreExitCode="true">
168+
<Output TaskParameter="ExitCode" PropertyName="DocFXExitCode" />
169+
</Exec>
170+
<!-- Quirk. 255 seems to be the exit code it uses but we don't know the reason, so we catch it and refer to the log -->
171+
<Error Condition="'$(DocFXExitCode)' != '255' AND '$(DocFXExitCode)' != '0'"
172+
Text="DocFX build failed with exit code $(DocFXExitCode). Check docfx-log.txt for details." />
168173
</Target>
169174

170175
</Project>

0 commit comments

Comments
 (0)