Skip to content

Commit ed9303a

Browse files
committed
fix: Fix execution of MSBuild-integrated docs generation
Use TargetFramework property to determine if current build is "inner build" to make condition work for both multi-targeted and projects with a single target framework. Previous approach did only work "by accident" as the "IsInnerBuild" property seems to be set by the SDK in mutli-targeted projects.
1 parent 436185e commit ed9303a

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

src/MdDocs.MSBuild/build/Grynwald.MdDocs.MSBuild.targets

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
Generates API reference docs for the project
77
-->
88
<Target Name="GenerateApiReferenceDocumentation"
9-
DependsOnTargets="_MdDocs-CheckForInnerBuild;GetTargetPath"
10-
Condition=" '$(IsInnerBuild)' == 'true'"> <!-- Only run in the "inner" build -->
9+
DependsOnTargets="GetTargetPath"
10+
Condition=" '$(TargetFramework)' != ''"> <!-- Only run in the "inner" build -->
1111

1212
<PropertyGroup>
1313
<ApiReferenceDocumentationOutputPath Condition=" '$(ApiReferenceDocumentationOutputPath)' == '' ">$(OutputPath)docs/api/</ApiReferenceDocumentationOutputPath>
@@ -39,8 +39,8 @@
3939
Generates command line docs for the project
4040
-->
4141
<Target Name="GenerateCommandLineDocumentation"
42-
DependsOnTargets="_MdDocs-CheckForInnerBuild;GetTargetPath"
43-
Condition=" '$(IsInnerBuild)' == 'true'"> <!-- Only run in the "inner" build -->
42+
DependsOnTargets="GetTargetPath"
43+
Condition=" '$(TargetFramework)' != ''"> <!-- Only run in the "inner" build -->
4444

4545
<PropertyGroup>
4646
<CommandLineDocumentationOutputPath Condition=" '$(CommandLineDocumentationOutputPath)' == '' ">$(OutputPath)docs/commandline/</CommandLineDocumentationOutputPath>
@@ -65,20 +65,5 @@
6565
AfterTargets="Build"
6666
DependsOnTargets="GenerateCommandLineDocumentation">
6767
</Target>
68-
69-
70-
<!--
71-
============================================================================================================
72-
Target "_MdDocs-CheckForInnerBuild"
73-
============================================================================================================
74-
Determines if were running in the "inner" build (multi-targeted csprojs run multiple "Build"
75-
targets (one "main" build and one build for every target framework)
76-
-->
77-
<Target Name="_MdDocs-CheckForInnerBuild">
78-
<PropertyGroup>
79-
<IsInnerBuild>true</IsInnerBuild>
80-
<IsInnerBuild Condition="'$(TargetFrameworks)' != '' AND '$(TargetFramework)' == ''">false</IsInnerBuild>
81-
</PropertyGroup>
82-
</Target>
8368

8469
</Project>

0 commit comments

Comments
 (0)