Skip to content

Commit

Permalink
Make src/native/managed projects use Microsoft.DotNet.ILCompiler vers…
Browse files Browse the repository at this point in the history
…ion from Version.props (dotnet#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`
  • Loading branch information
elinor-fung authored and matouskozak committed Apr 30, 2024
1 parent 69972de commit cf21f89
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/native/managed/compile-native.proj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Build.Traversal" DefaultTargets="Publish">
<Project Sdk="Microsoft.Build.Traversal">
<PropertyGroup>
<!-- We always want to use release for publishing using NativeAOT -->
<NativeLibsPublishConfiguration>Release</NativeLibsPublishConfiguration>
Expand Down Expand Up @@ -59,6 +59,7 @@
<ProjectReference Include="@(NativeLibsProjectsToBuild)"
ReferenceOutputAssembly="false"
AdditionalProperties="%(AdditionalProperties);$(SplitSubprojectProps)"
Condition="$(SupportsNativeAotComponents)"/>
Targets="LinkNative"
Condition="$(SupportsNativeAotComponents)"/>
</ItemGroup>
</Project>
6 changes: 6 additions & 0 deletions src/native/managed/native-library.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
the same way as eng/native/functions.cmake strip_symbols
-->
<StripSymbols>false</StripSymbols>
<SuppressGenerateILCompilerExplicitPackageReferenceWarning>true</SuppressGenerateILCompilerExplicitPackageReferenceWarning>
</PropertyGroup>

<!-- set the shared library name. this helps the native linker correctly reference this shared
Expand All @@ -32,4 +33,9 @@
<!-- passed by compile-native.proj to set - -gcc-toolchain=$(ROOTFS_DIR)/usr -->
<CustomLinkerArg Condition="'$(CustomLinkerArgToolchainArg)' != ''" Include="$(CustomLinkerArgToolchainArg)" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="$(MicrosoftDotNetILCompilerVersion)" />
<PackageReference Include="runtime.$(ToolsRID).Microsoft.DotNet.ILCompiler" Version="$(MicrosoftDotNetILCompilerVersion)" />
</ItemGroup>
</Project>

0 comments on commit cf21f89

Please sign in to comment.