diff options
author | Eric St. John <ericstj@microsoft.com> | 2017-04-03 20:15:17 +0300 |
---|---|---|
committer | Eric St. John <ericstj@microsoft.com> | 2017-04-03 20:15:28 +0300 |
commit | c42fd5602476dc88fd0d677a23ed15e8592a91e9 (patch) | |
tree | ff41976789e1a223d5875b9d7720b05d58aaf2f2 /dir.targets | |
parent | 5c1fe2a022ba2f30e390c3cd8501919e3f4f4db5 (diff) |
Add ILLink to the build
This adds ILLink (a .NET Core build of the mono linker) to the build
tools and uses it to trim non-public unreachable IL and metadata from
our assemblies.
This is enabled by default for any assembly that is part of NETCore.App.
This can be disabled by setting ILLinkTrimAssembly=false.
In some cases ILLink may trim too much, for example a runtime
dependency via reflection on private or internal API.
If we cannot update ILLink to understand this dependency via heuristic
then we can manually "root" the private or internal API.
This is done by adding an XML file next to the project with the name
ILLinkTrim.xml that follows the format documented here:
https://github.com/mono/linker/blob/master/linker/README
Diffstat (limited to 'dir.targets')
-rw-r--r-- | dir.targets | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/dir.targets b/dir.targets index f829b043a6..902a6c17dd 100644 --- a/dir.targets +++ b/dir.targets @@ -60,6 +60,8 @@ <PackageFileRefPath Condition="'$(IsNETCoreAppRef)' == 'true'">$(NETCoreAppPackageRefPath)</PackageFileRefPath> <PackageFileRuntimePath>$(NETCoreAppPackageRuntimePath)</PackageFileRuntimePath> <RuntimePath Condition="'$(BinPlaceNETCoreAppPackage)' == 'true'">$(NETCoreAppPackageRuntimePath)\..\runtime</RuntimePath> + <!-- enable trimming for any project that's part of the shared framework --> + <SetProperties Condition="'$(IsRuntimeAssembly)' == 'true'">ILLinkTrimAssembly=true</SetProperties> </BinPlaceConfiguration> <BinPlaceConfiguration Condition="'$(IsUAP)' == 'true' AND '$(BuildingUAPVertical)' == 'true'" Include="uap-$(_bc_OSGroup)"> <PackageFileRefPath Condition="'$(IsUAPRef)'=='true'">$(UAPPackageRefPath)</PackageFileRefPath> @@ -107,6 +109,7 @@ <Import Condition="Exists('$(MSBuildThisFileDirectory)..\open.targets')" Project="$(MSBuildThisFileDirectory)..\open.targets" /> <Import Project="$(MSBuildThisFileDirectory)referenceFromRuntime.targets" /> + <Import Project="$(MSBuildThisFileDirectory)illink.targets" /> <PropertyGroup> <!-- We don't use any of MSBuild's resolution logic for resolving the framework, so just set these two properties to any folder that exists to skip |