Skip to content

Commit

Permalink
Fix hardcoded ILAsm package version in Microsoft.NET.SDK.IL (#96069)
Browse files Browse the repository at this point in the history
We were still hardcoding version 6.0.0 of ILAsm in the targets, fix it by using a template and injecting the PackageVersion.

Fixes #49135
  • Loading branch information
akoeplinger authored Dec 15, 2023
1 parent 8725a6e commit 5dc63a6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,29 @@
</File>
</ItemGroup>

<PropertyGroup>
<ILTargetsTemplateFile>Microsoft.NET.Sdk.IL.targets.template</ILTargetsTemplateFile>
<ILTargetsOutputFile>$(IntermediateOutputPath)Microsoft.NET.Sdk.IL.targets</ILTargetsOutputFile>
</PropertyGroup>

<Target Name="ReplaceTemplateParametersInILTargetsTemplate"
Inputs="$(ILTargetsTemplateFile)"
Outputs="$(ILTargetsOutputFile)"
BeforeTargets="GetPackageFiles"
DependsOnTargets="CalculatePackageVersion">

<GenerateFileFromTemplate TemplateFile="$(ILTargetsTemplateFile)"
OutputPath="$(ILTargetsOutputFile)"
Properties="IlAsmVersion=$(PackageVersion)">
<Output TaskParameter="ResolvedOutputPath" ItemName="FileWrites" />
</GenerateFileFromTemplate>

<ItemGroup>
<File Include="$(ILTargetsOutputFile)">
<TargetPath>targets</TargetPath>
</File>
</ItemGroup>
</Target>

<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.targets))" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Copyright (c) .NET Foundation. All rights reserved.

<PropertyGroup>
<MicrosoftNetCoreIlasmPackageRuntimeId Condition="'$(MicrosoftNetCoreIlasmPackageRuntimeId)' == ''">$(NETCoreSdkPortableRuntimeIdentifier)</MicrosoftNetCoreIlasmPackageRuntimeId>
<MicrosoftNETCoreILAsmVersion Condition="'$(MicrosoftNETCoreILAsmVersion)' == ''">6.0.0</MicrosoftNETCoreILAsmVersion>
<MicrosoftNETCoreILAsmVersion Condition="'$(MicrosoftNETCoreILAsmVersion)' == ''">${IlAsmVersion}</MicrosoftNETCoreILAsmVersion>
<MicrosoftNetCoreIlasmPackageName>runtime.$(MicrosoftNetCoreIlasmPackageRuntimeId).microsoft.netcore.ilasm</MicrosoftNetCoreIlasmPackageName>
<MicrosoftNetCoreIldasmPackageName>runtime.$(MicrosoftNetCoreIlasmPackageRuntimeId).microsoft.netcore.ildasm</MicrosoftNetCoreIldasmPackageName>

Expand Down

0 comments on commit 5dc63a6

Please sign in to comment.