Example #1
0
        private bool IsFiltered(ITaskItem item)
        {
            // If assembly is part of the FX then it should be filtered out...
            // System.Reflection.AssemblyName.GetAssemblyName throws if file is not an assembly.
            // We're using AssemblyIdentity.FromManagedAssembly here because it just does an
            // OpenScope and returns null if not an assembly, which is much faster.

            AssemblyIdentity identity = AssemblyIdentity.FromManagedAssembly(item.ItemSpec);

            if (identity != null && identity.IsInFramework(Constants.DotNetFrameworkIdentifier, TargetFrameworkVersion))
            {
                return(true);
            }

            // If assembly is not a "Redist Root" then it should be filtered out...
            string str = item.GetMetadata("IsRedistRoot");

            if (!String.IsNullOrEmpty(str))
            {
                bool isRedistRoot;
                if (Boolean.TryParse(str, out isRedistRoot))
                {
                    return(!isRedistRoot);
                }
            }
            return(false);
        }