public void AddArtefact(string name, string relatedFile) { AssemblyArtifact dllInfo = AssemblyArtifact.Get(relatedFile); dllInfo.FileName = name; Artefacts.Add(dllInfo); }
public void AddArtefact(string path, BuildServers.BuildArtifact ba) { AssemblyArtifact dllInfo = new AssemblyArtifact { FileName = path, IsAssembly = ba.IsAssembly, Name = ba.Name, Version = ba.Version }; Artefacts.Add(dllInfo); }
// TODO: add scm revision to package version public AssemblyArtifacts AddRevision(string tag, string dllName, string pdbName, string dllPath) { AssemblyArtifact dllInfo = AssemblyArtifact.Get(dllPath); AssemblyArtifacts v = new AssemblyArtifacts() { VersionTag = tag, FileLibarary = dllName, FileSymbols = pdbName, AssemblyVersion = dllInfo.Version, AddedAt = DateTime.UtcNow }; Name = dllInfo.Name; Versions.Add(v); return(v); }
//public static AssemblyArtifact Get(byte[] data) //{ // AssemblyArtifact art = new AssemblyArtifact(); // using (MemoryStream ms = new MemoryStream(data)) // { // try // { // Mono.Cecil.AssemblyDefinition def = Mono.Cecil.AssemblyDefinition.ReadAssembly(ms); // Mono.Cecil.AssemblyNameReference defn = Mono.Cecil.AssemblyNameDefinition.Parse(def.FullName); // art.Version = defn.Version.ToString(); // art.Name = defn.Name; // art.IsAssembly = true; // } // catch // { // } // } // return art; //} public static AssemblyArtifact Get(string file) { AssemblyArtifact art = new AssemblyArtifact(); if (file.EndsWith(".dll")) { try { AssemblyName an = AssemblyName.GetAssemblyName(file); art.Version = an.Version.ToString(); art.Name = an.Name; art.IsAssembly = true; } catch (Exception e) { Console.WriteLine("I: {0}", e.Message); } } return art; }
//public static AssemblyArtifact Get(byte[] data) //{ // AssemblyArtifact art = new AssemblyArtifact(); // using (MemoryStream ms = new MemoryStream(data)) // { // try // { // Mono.Cecil.AssemblyDefinition def = Mono.Cecil.AssemblyDefinition.ReadAssembly(ms); // Mono.Cecil.AssemblyNameReference defn = Mono.Cecil.AssemblyNameDefinition.Parse(def.FullName); // art.Version = defn.Version.ToString(); // art.Name = defn.Name; // art.IsAssembly = true; // } // catch // { // } // } // return art; //} public static AssemblyArtifact Get(string file) { AssemblyArtifact art = new AssemblyArtifact(); if (file.EndsWith(".dll")) { try { AssemblyName an = AssemblyName.GetAssemblyName(file); art.Version = an.Version.ToString(); art.Name = an.Name; art.IsAssembly = true; } catch (Exception e) { Console.WriteLine("I: {0}", e.Message); } } return(art); }