List <BclFile> BclToDesigner(BclFileTarget ignoreForTarget) { return(BclFilesToInstall.Where(bf => ShouldIncludeDesignerBcl(bf)).Select(bf => new BclFile(bf.Name, bf.Type, bf.ExcludeDebugSymbols, version: bf.Version, target: ignoreForTarget)).ToList()); bool ShouldIncludeDesignerBcl(BclFile bf) { if (DesignerIgnoreFiles == null || !DesignerIgnoreFiles.TryGetValue(bf.Name, out (BclFileType Type, BclFileTarget Target)bft)) { return(true); } if (bf.Type != bft.Type || bft.Target != ignoreForTarget) { return(true); } Log.Instance.DebugLine($"BCL file {bf.Name} will NOT be included in the installed Designer BCL files ({ignoreForTarget})"); return(false); } }
bool GenerateFrameworkList(Context contex, string filePath, string bclDir, string facadesDir) { Log.DebugLine($"Generating {filePath}"); EnsureAllRuntimes(); var contents = new XElement( "FileList", new XAttribute("Redist", Runtimes.FrameworkListRedist), new XAttribute("Name", Runtimes.FrameworkListName), allRuntimes !.BclFilesToInstall.Where(f => f.Type == BclFileType.FacadeAssembly || f.Type == BclFileType.ProfileAssembly).Select(f => ToFileElement(f)) ); contents.Save(filePath); return(true); XElement ToFileElement(BclFile bcf) { Log.Debug("Writing "); string fullFilePath; switch (bcf.Type) { case BclFileType.ProfileAssembly: fullFilePath = Path.Combine(bclDir, bcf.Name); Log.Debug("profile"); break; case BclFileType.FacadeAssembly: Log.Debug("facade"); fullFilePath = Path.Combine(facadesDir, bcf.Name); break; default: Log.Debug("unsupported"); fullFilePath = String.Empty; break; } Log.DebugLine($" BCL assembly {bcf.Name}"); if (String.IsNullOrEmpty(fullFilePath)) { throw new InvalidOperationException($"Unsupported BCL file type {bcf.Type}"); } AssemblyName aname = AssemblyName.GetAssemblyName(fullFilePath); string version = bcf.Version ?? String.Empty; if (String.IsNullOrEmpty(version) && !Runtimes.FrameworkListVersionOverrides.TryGetValue(bcf.Name, out version)) { version = aname.Version.ToString(); } return(new XElement( "File", new XAttribute("AssemblyName", aname.Name), new XAttribute("Version", version), new XAttribute("PublicKeyToken", String.Join(String.Empty, aname.GetPublicKeyToken().Select(b => b.ToString("x2")))), new XAttribute("ProcessorArchitecture", aname.ProcessorArchitecture.ToString()) )); } }