Skip to content

Commit

Permalink
Don't trim PNSE assemblies and enable trimming for inbox assets on al…
Browse files Browse the repository at this point in the history
…l .NETCoreApp versions (#58345)

* Don't trim PNSE assemblies

Don't trim platform not supported assemblies, since even in "library" trimming mode, the trimmer might remove some non-public members if they are not called within the assembly. In the case of PNSE assemblies this is most likely always the case.
  • Loading branch information
ViktorHofer authored Oct 25, 2021
1 parent a7bdb16 commit 38cd1d6
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/libraries/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@
'$(DisableImplicitFrameworkReferences)' != 'true' and
'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and
('$(IsReferenceAssembly)' == 'true' or '$(IsSourceProject)' == 'true')">true</DisableImplicitAssemblyReferences>
<!-- Enable trimming for any source project that's part of the shared framework.
Don't attempt to trim PNSE assemblies which are generated from the reference source. -->
<ILLinkTrimAssembly Condition="'$(ILLinkTrimAssembly)' == '' and
'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and
'$(IsNETCoreAppSrc)' == 'true' and
'$(GeneratePlatformNotSupportedAssembly)' != 'true' and
'$(GeneratePlatformNotSupportedAssemblyMessage)' == ''">true</ILLinkTrimAssembly>
</PropertyGroup>

<Import Project="$(RepositoryEngineeringDir)versioning.targets" />
Expand Down Expand Up @@ -82,13 +89,6 @@
<RuntimePath>$(NetCoreAppCurrentRuntimePath)</RuntimePath>
</BinPlaceTargetFrameworks>

<BinPlaceTargetFrameworks Include="$(NetCoreAppCurrent)-$(TargetOS)"
Condition="'$(BuildTargetFramework)' == '$(NetCoreAppCurrent)' or '$(BuildTargetFramework)' == ''">
<!-- enable trimming for any runtime project that's part of the shared framework and hasn't already set ILLinkTrimAssembly -->
<SetProperties Condition="'$(IsNETCoreAppSrc)' == 'true' and
'$(BinPlaceRuntime)' == 'true' and
'$(ILLinkTrimAssembly)' == ''">ILLinkTrimAssembly=true</SetProperties>
</BinPlaceTargetFrameworks>
<BinPlaceDir Include="$(MicrosoftNetCoreAppRefPackDir)analyzers\dotnet\$(AnalyzerLanguage)"
Condition="'$(IsNETCoreAppAnalyzer)' == 'true'" />

Expand Down

0 comments on commit 38cd1d6

Please sign in to comment.