Bugs item #1262050, was opened at 2005-08-17 12:42
Message generated for change (Comment added) made by kutulu
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=402868&aid=1262050&group_id=31650

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Tasks
Group: 0.85
Status: Open
Resolution: None
Priority: 5
Submitted By: Boudino (boudino)
Assigned to: Nobody/Anonymous (nobody)
Summary: Solution tasks does not understood VS 2005 format

Initial Comment:
Solution task is not ready for VS 2005 formats. 
Both .sln and .csproj fileshas changed.

NAnt fails with:
Error loading GUID of project 'myproject.csproj'.             
Couldn't locate ProjectGuid in project 'myproject.csproj'.
            


----------------------------------------------------------------------

Comment By: Michael Edenfield (kutulu)
Date: 2006-01-03 22:29

Message:
Logged In: YES 
user_id=67958

Wow that line wrapping was horrible.  See patch file:

http://www.kutulu.org/1262050.diff

----------------------------------------------------------------------

Comment By: Michael Edenfield (kutulu)
Date: 2006-01-03 22:27

Message:
Logged In: YES 
user_id=67958

The following patch file should correct this (simply needs
to look in a different XML path for the GUID).

--- ProjectSettings.cs.old      2005-03-03 05:49:54.000000000 -0500
+++ ProjectSettings.cs  2006-01-03 17:12:46.677016500 -0500
@@ -312,15 +312,29 @@
         /// The project GUID from specified
<c>&lt;VisualStudioProject&gt;</c> node.
         /// </returns>
         public static string GetProjectGuid(string
projectFile, XmlElement elemRoot) {
-            XmlAttribute projectGuid = (XmlAttribute)
elemRoot.FirstChild.
-                Attributes["ProjectGuid"];
-            if (projectGuid == null) {
-                throw new
BuildException(string.Format(CultureInfo.InvariantCulture,
-                    "Project file '{0}' is not valid.
There's no \"ProjectGuid\""
-                    + " attribute on the <{1} ... />
node.", projectFile, 
-                    elemRoot.FirstChild.Name),
Location.UnknownLocation);
+            string projectGuid = String.Empty;
+            
+            // Try the VS.NET/VS.NET 2003 proejct file
format first.
+            // Example XPath =
/VisualStudioProject/CSHARP/@ProjectGuid
+            XmlNode projectGuidNode =
elemRoot.FirstChild.Attributes["ProjectGuid"];
+            if (projectGuidNode == null) {
+               // Try the new VS.NET 2005 format.
+               // Example XPath =
/Project/PropertyGroup/ProjectGuid
+               projectGuidNode =
elemRoot.SelectSingleNode("//PropertyGroup/ProjectGuid");
+               if (projectGuidNode == null) {
+                   // Not any recognizeable format.
+                    throw new
BuildException(string.Format(CultureInfo.InvariantCulture,
+                        "Project file '{0}' is not valid.
There's no \"ProjectGuid\""
+                        + " attribute/element on the <{1}
... /> node.",
+                        projectFile,
elemRoot.FirstChild.Name), Location.UnknownLocation);
+                }
+                projectGuid =
projectGuidNode.InnerText.ToUpper(CultureInfo.InvariantCulture);
             }
-            return
projectGuid.Value.ToUpper(CultureInfo.InvariantCulture);
+            else {
+                projectGuid =
projectGuidNode.Value.ToUpper(CultureInfo.InvariantCulture);
+            }
+            
+            return projectGuid;
         }
 
         #endregion Public Static Methods


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=402868&aid=1262050&group_id=31650


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
nant-developers mailing list
nant-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to