dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.66k stars 1.06k forks source link

Mark assets from nuget packages as trimmable #3302

Open sbomer opened 5 years ago

sbomer commented 5 years ago

https://github.com/dotnet/sdk/pull/3231 flows IsTrimmable metadata from FrameworkRefrences to the resolved assets. We could consider doing the same for PackageReferences to enable users to easily opt in to trimming assets that come from packages. Since the metadata was not originally intended as a customer-facing option, we may want to revisit this to see if it's the right way to expose such an option.

From https://github.com/mono/linker/issues/595#issuecomment-498951483:

one of the assemblies I really would like to see reduced MahApps.Metro.IconPacks.dll is not. This DLL is 14MB but I probably use around 500KB... any way to see what happened and influence this?

This would come with the usual caveats: packages with logic that is activated by reflection, or that themselves use reflection, will likely be incompatible with trimming.

Lakritzator commented 5 years ago

Yes, this would definitively be a feature I would like to see. I believe I discussed this with Bri or Daniel last year...

szpght commented 4 years ago

I also would like to be able to use this option. I use LanguageExt (https://github.com/louthy/language-ext) which with PublishReadyToRun enabled grows to ~70MB and I probably use only a small part.

livarcocc commented 4 years ago

@jeffschwMSFT should this be tracked here or somewhere else?