From 55d89b73edbfc12da6f6ec11c6f1aa429a7e7a40 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Tue, 17 Feb 2009 16:15:29 +0000 Subject: * fixed 'path' reference attribute for Nant and VS2008 targets. --- Prebuild/src/Core/Targets/NAntTarget.cs | 148 +++++++++++++++++--------------- 1 file changed, 79 insertions(+), 69 deletions(-) (limited to 'Prebuild/src/Core/Targets/NAntTarget.cs') diff --git a/Prebuild/src/Core/Targets/NAntTarget.cs b/Prebuild/src/Core/Targets/NAntTarget.cs index b64c57e..eb5325d 100644 --- a/Prebuild/src/Core/Targets/NAntTarget.cs +++ b/Prebuild/src/Core/Targets/NAntTarget.cs @@ -94,42 +94,45 @@ namespace Prebuild.Core.Targets string ret = ""; string referencePath = ((ReferencePathNode)currentProject.ReferencePaths[0]).Path; - if (solution.ProjectsTable.ContainsKey(refr.Name)) + if (String.IsNullOrEmpty(refr.Path)) { - ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; - string finalPath = Helper.NormalizePath(referencePath + refr.Name + GetProjectExtension(project), '/'); - return finalPath; - } - else - { - if (refr.Name == "Pootface.exe") + if (solution.ProjectsTable.ContainsKey(refr.Name)) { - Console.WriteLine("Poot!"); + ProjectNode project = (ProjectNode) solution.ProjectsTable[refr.Name]; + string finalPath = + Helper.NormalizePath(referencePath + refr.Name + GetProjectExtension(project), '/'); + return finalPath; } + else + { + ProjectNode project = (ProjectNode) refr.Parent; - ProjectNode project = (ProjectNode) refr.Parent; + // Do we have an explicit file reference? + string fileRef = FindFileReference(refr.Name, project); + if (fileRef != null) + { + return fileRef; + } - // 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), '/'); + } - // Is there an explicit path in the project ref? - if (refr.Path != null) - { - return Helper.NormalizePath( refr.Path + "/" + refr.Name + GetProjectExtension(project), '/'); - } + // Is it a specified extension (dll or exe?) + if (ExtensionSpecified(refr.Name)) + { + return Helper.NormalizePath(referencePath + GetRefFileName(refr.Name), '/'); + } - // Is it a specified extension (dll or exe?) - if (ExtensionSpecified(refr.Name)) - { - return Helper.NormalizePath( referencePath + GetRefFileName(refr.Name), '/'); + // No, it's an extensionless GAC ref, but nant needs the .dll extension anyway + return refr.Name + ".dll"; } - - // No, it's an extensionless GAC ref, but nant needs the .dll extension anyway - return refr.Name + ".dll"; + } + else + { + return refr.Path; } } @@ -160,47 +163,54 @@ namespace Prebuild.Core.Targets return extension; } - 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 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 + // { + // if (refr.Path == null) + // { + // 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 += ""; + // } + // } + // else + // { + // ret = refr.Path; + // } + // } + // return ret; + //} private static string FindFileReference(string refName, ProjectNode project) { -- cgit v1.1