|
12 | 12 |
|
13 | 13 | <!-- Determine which task assembly to load based on MSBuild runtime --> |
14 | 14 | <PropertyGroup> |
15 | | - <!-- Determine the target framework for tasks based on MSBuild runtime --> |
16 | | - <_DotNetDocsTaskFramework Condition="'$(MSBuildRuntimeType)' == 'Core'">net8.0</_DotNetDocsTaskFramework> |
17 | 15 | <_DotNetDocsTaskFramework Condition="'$(MSBuildRuntimeType)' == 'Full'">net472</_DotNetDocsTaskFramework> |
| 16 | + |
| 17 | + <!-- For .NET Core MSBuild, match task TFM to the runtime major version --> |
| 18 | + <_DotNetDocsRuntimeMajor Condition="'$(MSBuildRuntimeType)' == 'Core'">$([System.Environment]::Version.Major)</_DotNetDocsRuntimeMajor> |
| 19 | + <_DotNetDocsTaskFramework Condition="'$(MSBuildRuntimeType)' == 'Core'">net$(_DotNetDocsRuntimeMajor).0</_DotNetDocsTaskFramework> |
| 20 | + |
| 21 | + <!-- Fallback if runtime detection fails --> |
18 | 22 | <_DotNetDocsTaskFramework Condition="'$(_DotNetDocsTaskFramework)' == ''">net8.0</_DotNetDocsTaskFramework> |
19 | | - |
| 23 | + |
20 | 24 | <!-- Tasks are always loaded from the packaged location --> |
21 | 25 | <_DotNetDocsTasksFolder>$(MSBuildThisFileDirectory)..\tasks\$(_DotNetDocsTaskFramework)</_DotNetDocsTasksFolder> |
22 | 26 | <_DotNetDocsTasksAssembly>$(_DotNetDocsTasksFolder)\CloudNimble.DotNetDocs.Sdk.Tasks.dll</_DotNetDocsTasksAssembly> |
| 27 | + |
| 28 | + <!-- If version-matched tasks don't exist, fall back to net8.0 --> |
| 29 | + <_DotNetDocsTasksFolder Condition="!Exists('$(_DotNetDocsTasksAssembly)')">$(MSBuildThisFileDirectory)..\tasks\net8.0</_DotNetDocsTasksFolder> |
| 30 | + <_DotNetDocsTasksAssembly Condition="!Exists('$(_DotNetDocsTasksAssembly)')">$(_DotNetDocsTasksFolder)\CloudNimble.DotNetDocs.Sdk.Tasks.dll</_DotNetDocsTasksAssembly> |
23 | 31 | </PropertyGroup> |
24 | 32 |
|
25 | 33 | <!-- Load compiled MSBuild tasks when they exist --> |
|
43 | 51 |
|
44 | 52 | <!-- Documentation project validation and information --> |
45 | 53 | <Target Name="ValidateDocumentationProject" BeforeTargets="Build"> |
| 54 | + <Message Text="🔧 DotNetDocs SDK task runtime: .NET $(_DotNetDocsRuntimeMajor) → $(_DotNetDocsTaskFramework)" Importance="high" Condition="'$(_DotNetDocsRuntimeMajor)' != ''" /> |
| 55 | + <Message Text="🔧 DotNetDocs SDK task runtime: .NET Framework → $(_DotNetDocsTaskFramework)" Importance="high" Condition="'$(_DotNetDocsRuntimeMajor)' == ''" /> |
46 | 56 | <Message Text="✅ Documentation project: $(MSBuildProjectName)" Importance="high" /> |
47 | 57 | <Message Text="📄 Documentation type: $(DocumentationType)" Importance="high" /> |
48 | 58 | <Message Text="📂 Documentation root: $(DocumentationRoot)" Importance="high" Condition="'$(DocumentationRoot)' != '$(MSBuildProjectDirectory)\'" /> |
|
0 commit comments