Skip to content

Commit 6b9381b

Browse files
authored
Make src/native/managed projects use Microsoft.DotNet.ILCompiler version from Version.props (#100845)
- Use the version of Microsoft.DotNet.ILCompiler specified in Version.props when producing runtime components in src/native/managed via NativeAOT - This is the same version that `ILCompiler.csproj` / `ilc` itself uses to publish as NativeAOT - Reduce the number of copies of the output by avoiding publishing and just running `LinkNative`
1 parent 89aae24 commit 6b9381b

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/native/managed/compile-native.proj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.Build.Traversal" DefaultTargets="Publish">
1+
<Project Sdk="Microsoft.Build.Traversal">
22
<PropertyGroup>
33
<!-- We always want to use release for publishing using NativeAOT -->
44
<NativeLibsPublishConfiguration>Release</NativeLibsPublishConfiguration>
@@ -59,6 +59,7 @@
5959
<ProjectReference Include="@(NativeLibsProjectsToBuild)"
6060
ReferenceOutputAssembly="false"
6161
AdditionalProperties="%(AdditionalProperties);$(SplitSubprojectProps)"
62-
Condition="$(SupportsNativeAotComponents)"/>
62+
Targets="LinkNative"
63+
Condition="$(SupportsNativeAotComponents)"/>
6364
</ItemGroup>
6465
</Project>

src/native/managed/native-library.props

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
the same way as eng/native/functions.cmake strip_symbols
77
-->
88
<StripSymbols>false</StripSymbols>
9+
<SuppressGenerateILCompilerExplicitPackageReferenceWarning>true</SuppressGenerateILCompilerExplicitPackageReferenceWarning>
910
</PropertyGroup>
1011

1112
<!-- set the shared library name. this helps the native linker correctly reference this shared
@@ -32,4 +33,9 @@
3233
<!-- passed by compile-native.proj to set - -gcc-toolchain=$(ROOTFS_DIR)/usr -->
3334
<CustomLinkerArg Condition="'$(CustomLinkerArgToolchainArg)' != ''" Include="$(CustomLinkerArgToolchainArg)" />
3435
</ItemGroup>
36+
37+
<ItemGroup>
38+
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="$(MicrosoftDotNetILCompilerVersion)" />
39+
<PackageReference Include="runtime.$(ToolsRID).Microsoft.DotNet.ILCompiler" Version="$(MicrosoftDotNetILCompilerVersion)" />
40+
</ItemGroup>
3541
</Project>

0 commit comments

Comments
 (0)