Pruning code
Published 31 December 2012
Pruning removes code that will never be executed at runtime. Pruning also removes metadata such as design attributes and the names of events and properties.
Pruning reduces the size of your assemblies, and improves loading time and performance. Removing non-useful metadata can protect your code by making it more difficult to understand.
To prune code
To prune code, in the Project Settings window, go to Pruning or click the icon in the toolbar.
Select the assemblies to prune.
When pruning is enabled, the colored bars under the toolbar icon and to the left of the features options are green. If it is disabled, the bars are orange.
If you experience problems, see Troubleshooting pruning.
SmartAssembly does not prune public members of DLL files, because the DLL will be unusable.
Pruning example
The following example shows code before and after pruning:
Before pruning:
[DefaultMember("Item")] public sealed class DiscoveryClientResultCollection : CollectionBase [XmlRoot("discovery", Namespace="http://schemas.xmlsoap.org/disco/")] public sealed class DiscoveryDocument public class DiscoveryDocumentLinksPattern : DiscoverySearchPattern [XmlRoot("discoveryRef", Namespace="http://schemas.xmlsoap.org/disco/")] public sealed class DiscoveryDocumentReference : DiscoveryReference public sealed class DiscoveryDocumentSearchPattern : DiscoverySearchPattern internal TraceMethod(object target, string name, params object[] args); internal static string CallString(object target, string method, params object[] args); private static string HashString(object objectValue); internal static string MethodId(object target, string method); public override string ToString(); private static void WriteObjectId(StringBuilder sb, object o); private static void WriteValue(StringBuilder sb, object o);
After pruning:
[DefaultMember("Item")] public sealed class DiscoveryClientResultCollection : CollectionBase public sealed class DiscoveryDocumentSearchPattern : DiscoverySearchPattern internal TraceMethod(object 1, string 1, params object[] strings); private static string HashString(object 1); internal static string MethodId(object 1, string 1);