protected static bool IncludeAssemblyWhenCopyingDeps(AssemblyReference assemblyReference, Regex[] assemblyNamePatterns, bool ignoreOnlyMatching) { if (assemblyNamePatterns.Any()) { return(BoolExtensions.Flip(assemblyNamePatterns.Any(r => r.IsMatch(assemblyReference.Name)), ignoreOnlyMatching)); } // when no patterns are given, include all assemblies (don't filter) return(true); }
/// <summary> /// Validates that the assembly references have valid hint paths. /// <para>(Not validated automatically, you must call this if you want to validate)</para> /// </summary> public void ValidateHintPaths(Regex[] assemblyNamePatterns, bool ignoreOnlyMatching) { var invalidHintPathAssemblies = this.AssemblyReferences .Where(x => String.IsNullOrWhiteSpace(x.HintPath)); if (assemblyNamePatterns.Any()) { // Filter assemblies only if some patterns were given. invalidHintPathAssemblies = invalidHintPathAssemblies .Where(x => BoolExtensions.Flip(assemblyNamePatterns.Any(r => r.IsMatch(x.Name)), ignoreOnlyMatching)); } if (invalidHintPathAssemblies.Any()) { var errorMessage = String.Format("Found assembly references with empty HintPaths in project '{0}'. Assembly references:\n{1}", this.ToString(), StringExtensions.Tabify(invalidHintPathAssemblies.Select(x => x.ToString()))); _logger.Debug(errorMessage); } }