Skip to content

Commit 46b04cd

Browse files
authored
Avoid hardcoded illink.tasks TFM
Replaces #109619 We made a similar change recently in arcade to not use the TFM but a normalized value of the TargetFrameworkIdentifier property for tools packages.
1 parent 809d3d2 commit 46b04cd

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

eng/packaging.targets

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,13 +303,21 @@
303303

304304
<!-- Manual invoked target that can be used by toolset packages by adding it to the `TargetsForTfmSpecificContentInPackage` property. -->
305305
<Target Name="AddBuildOutputToToolsPackage">
306+
<PropertyGroup Condition="'$(BuildTaskTargetTfmSpecificFolder)' == ''">
307+
<BuildTaskTargetTfmSpecificFolder Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">net</BuildTaskTargetTfmSpecificFolder>
308+
<BuildTaskTargetTfmSpecificFolder Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">netframework</BuildTaskTargetTfmSpecificFolder>
309+
</PropertyGroup>
310+
311+
<Error Text="The 'BuildTaskTargetTfmSpecificFolder' property must be explicitly set when not targeting .NETCoreApp or .NETFramework"
312+
Condition="'$(BuildTaskTargetTfmSpecificFolder)' == ''" />
313+
306314
<ItemGroup>
307315
<!-- Include build outputs in the package under tools directory. -->
308316
<_BuildOutputPackageFile Include="$(OutputPath)**"
309317
Exclude="$(OutputPath)publish\**;
310318
$(OutputPath)" />
311319
<TfmSpecificPackageFile Include="@(_BuildOutputPackageFile)"
312-
PackagePath="tools/$(TargetFramework)/%(RecursiveDir)%(FileName)%(Extension)" />
320+
PackagePath="tools/$(BuildTaskTargetTfmSpecificFolder)/%(RecursiveDir)%(FileName)%(Extension)" />
313321
<TfmSpecificDebugSymbolsFile Include="@(TfmSpecificPackageFile->WithMetadataValue('Extension', '.pdb'))"
314322
TargetPath="/%(TfmSpecificPackageFile.PackagePath)/%(Filename)%(Extension)"
315323
TargetFramework="$(TargetFramework)"

src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.Tasks.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ Copyright (c) .NET Foundation. All rights reserved.
1818
<!-- Older SDKs used this property as a sentinel instead, to control the import of this file
1919
(but not the targets, which were included with the SDK). -->
2020
<UsingILLinkTasksSdk>true</UsingILLinkTasksSdk>
21-
<ILLinkTasksAssembly Condition="'$(MSBuildRuntimeType)' == 'Core'">$(MSBuildThisFileDirectory)..\tools\net9.0\ILLink.Tasks.dll</ILLinkTasksAssembly>
22-
<ILLinkTasksAssembly Condition="'$(MSBuildRuntimeType)' != 'Core'">$(MSBuildThisFileDirectory)..\tools\net472\ILLink.Tasks.dll</ILLinkTasksAssembly>
21+
<ILLinkTasksAssembly Condition="'$(MSBuildRuntimeType)' == 'Core'">$(MSBuildThisFileDirectory)..\tools\net\ILLink.Tasks.dll</ILLinkTasksAssembly>
22+
<ILLinkTasksAssembly Condition="'$(MSBuildRuntimeType)' != 'Core'">$(MSBuildThisFileDirectory)..\tools\netframework\ILLink.Tasks.dll</ILLinkTasksAssembly>
2323

2424
<ILLinkAnalyzersPropsPath Condition="'$(ILLinkAnalyzersPropsPath)' == ''">$(MSBuildThisFileDirectory)Microsoft.NET.ILLink.Analyzers.props</ILLinkAnalyzersPropsPath>
2525
</PropertyGroup>

0 commit comments

Comments
 (0)