//static ManifestDependency _md; static void AddFile(Manifest cfg, String name, String exts, String src, String target) { if (!name.IsNullOrEmpty()) { exts = exts.Split(";").Select(e => name + "." + e).Join(";"); } var fs = src.AsDirectory().GetAllFiles(exts).ToList(); //XTrace.WriteLine("目录:{0} 文件:{1}", src.AsDirectory().FullName, fs.Count); if (fs.Count == 0) { return; } var dgs = cfg.Metadata.DependencySets; var dg = new ManifestDependencySet(); switch (target.Substring(@"\")) { case "net20": dg.TargetFramework = ".NETFramework2.0"; break; case "net40": dg.TargetFramework = ".NETFramework4.0"; break; case "net45": dg.TargetFramework = ".NETFramework4.5"; break; case "netstandard2.0": dg.TargetFramework = ".NETStandard2.0"; break; case "netcoreapp2.1": dg.TargetFramework = "netcoreapp2.1"; break; } dg.Dependencies = new List <ManifestDependency>(); /*if(_md == null) * { * var md = new ManifestDependency(); * md.Id = "NewLife.Core"; * md.Version = "7.0.6706.20578"; * md.Exclude = "Build,Analyzers"; * * _md = md; * dg.Dependencies.Add(md); * }*/ if (!dg.TargetFramework.IsNullOrEmpty()) { dgs.Add(dg); } XTrace.WriteLine("目录:{0} 框架:{1} 文件:{2}", src, dg.TargetFramework, fs.Count); foreach (var item in fs) { var mf = new ManifestFile(); mf.Source = item.FullName; mf.Target = @"{0}\{1}".F(target, item.Name); cfg.Files.Add(mf); } }
static void AddFile(Manifest cfg, String name, String exts, String src, String target) { exts = exts.Split(";").Select(e => name + "." + e).Join(";"); foreach (var item in src.AsDirectory().GetAllFiles(exts)) { var mf = new ManifestFile(); mf.Source = item.FullName; mf.Target = @"{0}\{1}".F(target, item.Name); cfg.Files.Add(mf); } }
static void AddFile(Manifest cfg, String name, String ext, Boolean fx2 = true) { var mf = new ManifestFile(); if (fx2) { mf.Source = @"..\..\BIN\{0}.{1}".F(name, ext); mf.Target = @"lib\net20\{0}.{1}".F(name, ext); } else { mf.Source = @"..\..\BIN4\{0}.{1}".F(name, ext); mf.Target = @"lib\net40\{0}.{1}".F(name, ext); } if (File.Exists(mf.Source.GetFullPath())) { cfg.Files.Add(mf); } }