private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr) { if (!String.IsNullOrEmpty(refr.Path)) { return refr.Path; } if (solution.ProjectsTable.ContainsKey(refr.Name)) { ProjectNode projectRef = (ProjectNode) solution.ProjectsTable[refr.Name]; string finalPath = Helper.NormalizePath(refr.Name + GetProjectExtension(projectRef), '/'); return finalPath; } ProjectNode project = (ProjectNode) refr.Parent; // Do we have an explicit file reference? string fileRef = FindFileReference(refr.Name, project); if (fileRef != null) { return fileRef; } // Is there an explicit path in the project ref? if (refr.Path != null) { return Helper.NormalizePath(refr.Path + "/" + refr.Name + GetProjectExtension(project), '/'); } // No, it's an extensionless GAC ref, but nant needs the .dll extension anyway return refr.Name + ".dll"; }
private static string BuildReference(SolutionNode solution, ReferenceNode refr) { string ret = "<ProjectReference type=\""; if(solution.ProjectsTable.ContainsKey(refr.Name)) { ret += "Project\""; ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\" refto=\"" + refr.Name + "\" />"; } else { ProjectNode project = (ProjectNode)refr.Parent; string fileRef = FindFileReference(refr.Name, project); if(refr.Path != null || fileRef != null) { ret += "Assembly\" refto=\""; string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef; ret += finalPath; ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; return ret; } ret += "Gac\""; ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\""; ret += " refto=\""; try { /* Day changed to 28 Mar 2007 ... 08:09 < cj> is there anything that replaces Assembly.LoadFromPartialName() ? 08:09 < jonp> no 08:10 < jonp> in their infinite wisdom [sic], microsoft decided that the ability to load any assembly version by-name was an inherently bad idea 08:11 < cj> I'm thinking of a bunch of four-letter words right now... 08:11 < cj> security through making it difficult for the developer!!! 08:12 < jonp> just use the Obsolete API 08:12 < jonp> it should still work 08:12 < cj> alrighty. 08:12 < jonp> you just get warnings when using it */ Assembly assem = Assembly.LoadWithPartialName(refr.Name); ret += assem.FullName; //ret += refr.Name; } catch (System.NullReferenceException e) { e.ToString(); ret += refr.Name; } ret += "\" />"; } return ret; }
private static string BuildReference(SolutionNode solution, ReferenceNode refr) { string ret = ""; if (solution.ProjectsTable.ContainsKey(refr.Name)) { ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; string fileRef = FindFileReference(refr.Name, project); string finalPath = Helper.NormalizePath(Helper.MakeFilePath(project.FullPath + "/${build.dir}/", refr.Name, "dll"), '/'); ret += finalPath; return ret; } else { ProjectNode project = (ProjectNode)refr.Parent; string fileRef = FindFileReference(refr.Name, project); if (refr.Path != null || fileRef != null) { string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path + "/" + refr.Name + ".dll", '/') : fileRef; ret += finalPath; return ret; } try { //Assembly assem = Assembly.Load(refr.Name); //if (assem != null) //{ //ret += (refr.Name + ".dll"); //} //else //{ ret += (refr.Name + ".dll"); //} } catch (System.NullReferenceException e) { e.ToString(); ret += refr.Name + ".dll"; } } return ret; }
private static string BuildReference(SolutionNode solution, ReferenceNode refr) { string ret = "<ProjectReference type=\""; if(solution.ProjectsTable.ContainsKey(refr.Name)) { ret += "Project\""; ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\" refto=\"" + refr.Name + "\" />"; } else { ProjectNode project = (ProjectNode)refr.Parent; string fileRef = FindFileReference(refr.Name, project); if(refr.Path != null || fileRef != null) { ret += "Assembly\" refto=\""; string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef; ret += finalPath; ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; return ret; } ret += "Gac\""; ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\""; ret += " refto=\""; try { Assembly assem = Assembly.LoadWithPartialName(refr.Name); ret += assem.FullName; } catch (System.NullReferenceException e) { e.ToString(); ret += refr.Name; } ret += "\" />"; } return ret; }
private static string BuildReference(SolutionNode solution, ReferenceNode refr) { string ret = ""; if (solution.ProjectsTable.ContainsKey(refr.Name)) { ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; string fileRef = FindFileReference(refr.Name, project); string finalPath = Helper.NormalizePath(Helper.MakeFilePath("${build.dir}/", refr.Name, GetExtension(refr.Name)), '/'); ret += finalPath; return ret; } else { ProjectNode project = (ProjectNode)refr.Parent; string fileRef = FindFileReference(refr.Name, project); string ext = GetExtension(refr.Name); if (refr.Path != null || fileRef != null) { string finalPath = (refr.Path != null) ? Helper.NormalizePath(Helper.MakeFilePath("${build.dir}/", refr.Name, ext), '/') : fileRef; ret += finalPath; return ret; } if (refr.Name.EndsWith(".exe") || refr.Name.EndsWith(".dll")) ret += refr.Name; else ret += refr.Name + ".dll"; } return ret; }
private static string BuildReference(SolutionNode solution, ReferenceNode refr) { string ret = ""; if(solution.ProjectsTable.ContainsKey(refr.Name)) { ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; string fileRef = FindFileReference(refr.Name, project); string finalPath = Helper.NormalizePath(Helper.MakeFilePath(project.FullPath + "/$(BUILD_DIR)/$(CONFIG)/", refr.Name, "dll"), '/'); ret += finalPath; return ret; } else { ProjectNode project = (ProjectNode)refr.Parent; string fileRef = FindFileReference(refr.Name, project); if(refr.Path != null || fileRef != null) { string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path + "/" + refr.Name + ".dll", '/') : fileRef; ret += Path.Combine(project.Path, finalPath); return ret; } try { //Assembly assem = Assembly.Load(refr.Name); //if (assem != null) //{ // int index = refr.Name.IndexOf(","); // if ( index > 0) // { // ret += assem.Location; // //Console.WriteLine("Location1: " + assem.Location); // } // else // { // ret += (refr.Name + ".dll"); // //Console.WriteLine("Location2: " + assem.Location); // } //} //else //{ int index = refr.Name.IndexOf(","); if ( index > 0) { ret += refr.Name.Substring(0, index) + ".dll"; //Console.WriteLine("Location3: " + assem.Location); } else { ret += (refr.Name + ".dll"); //Console.WriteLine("Location4: " + assem.Location); } //} } catch (System.NullReferenceException e) { e.ToString(); int index = refr.Name.IndexOf(","); if ( index > 0) { ret += refr.Name.Substring(0, index) + ".dll"; //Console.WriteLine("Location5: " + assem.Location); } else { ret += (refr.Name + ".dll"); //Console.WriteLine("Location6: " + assem.Location); } } } return ret; }
public int CompareTo(object obj) { ReferenceNode that = (ReferenceNode)obj; return(this.m_Name.CompareTo(that.m_Name)); }
private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr) { string ret = ""; if(solution.ProjectsTable.ContainsKey(refr.Name)) { ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; string finalPath = Helper.NormalizePath(((ReferencePathNode)project.ReferencePaths[0]).Path, '/'); return finalPath; } else { ProjectNode project = (ProjectNode)refr.Parent; string fileRef = FindFileReference(refr.Name, project); if(refr.Path != null || fileRef != null) { string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef; ret += finalPath; return ret; } try { Assembly assem = Assembly.Load(refr.Name); if (assem != null) { ret += ""; } else { ret += ""; } } catch (System.NullReferenceException e) { e.ToString(); ret += ""; } } return ret; }
private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr) { string ret = ""; if (solution.ProjectsTable.ContainsKey(refr.Name)) { ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; string finalPath = Helper.NormalizePath(((ReferencePathNode)currentProject.ReferencePaths[0]).Path + refr.Name + GetProjectExtension(project), '/'); return finalPath; } else { ProjectNode project = (ProjectNode)refr.Parent; string fileRef = FindFileReference(refr.Name, project); if (refr.Path != null || fileRef != null) { string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path + "/" + refr.Name + GetProjectExtension(project), '/') : fileRef; ret += finalPath; return ret; } ret += (refr.Name + ".dll"); } return ret; }