Author: ankit
Date: 2007-09-11 16:01:01 -0400 (Tue, 11 Sep 2007)
New Revision: 85656
Modified:
trunk/monodevelop/Extras/prj2make-sharp-lib/ChangeLog
trunk/monodevelop/Extras/prj2make-sharp-lib/MSBuildFileFormat.cs
trunk/monodevelop/Extras/prj2make-sharp-lib/SlnFileFormat.cs
Log:
Fix bug#82688.
* MSBuildFileFormat.cs (ReferenceToXmlElement): Set Name for project
reference only when creating a new element.
* SlnFileFormat.cs (LoadSolution): Resolve any unresolved project
references using the project guids.
Modified: trunk/monodevelop/Extras/prj2make-sharp-lib/ChangeLog
===================================================================
--- trunk/monodevelop/Extras/prj2make-sharp-lib/ChangeLog 2007-09-11
19:57:15 UTC (rev 85655)
+++ trunk/monodevelop/Extras/prj2make-sharp-lib/ChangeLog 2007-09-11
20:01:01 UTC (rev 85656)
@@ -1,3 +1,11 @@
+2007-09-12 Ankit Jain <[EMAIL PROTECTED]>
+
+ Fix bug#82688.
+ * MSBuildFileFormat.cs (ReferenceToXmlElement): Set Name for project
+ reference only when creating a new element.
+ * SlnFileFormat.cs (LoadSolution): Resolve any unresolved project
+ references using the project guids.
+
2007-09-11 Ankit Jain <[EMAIL PROTECTED]>
Fix bug#82736.
Modified: trunk/monodevelop/Extras/prj2make-sharp-lib/MSBuildFileFormat.cs
===================================================================
--- trunk/monodevelop/Extras/prj2make-sharp-lib/MSBuildFileFormat.cs
2007-09-11 19:57:15 UTC (rev 85655)
+++ trunk/monodevelop/Extras/prj2make-sharp-lib/MSBuildFileFormat.cs
2007-09-11 20:01:01 UTC (rev 85656)
@@ -608,6 +608,7 @@
{
ReferenceType refType = projectRef.ReferenceType;
+ bool newElement = false;
XmlDocument doc = d.Document;
XmlElement elem;
if (!d.ProjectReferenceElements.TryGetValue
(projectRef, out elem)) {
@@ -618,6 +619,7 @@
elemName = "Reference";
elem = doc.CreateElement (elemName, ns);
+ newElement = true;
//Add the element to the document
XmlNode node = doc.SelectSingleNode
(String.Format ("/tns:Project/tns:ItemGroup/tns:{0}", elemName),
NamespaceManager);
@@ -671,7 +673,10 @@
EnsureChildValue (elem,
"Project", ns, String.Concat ("{", data.Guid, "}"));
}
- EnsureChildValue (elem, "Name", ns,
Escape (p.Name));
+ if (newElement)
+ //Set Name only for newly
created elements, this could be
+ //different from referenced
project's Name
+ EnsureChildValue (elem, "Name",
ns, Escape (p.Name));
}
break;
case ReferenceType.Custom:
Modified: trunk/monodevelop/Extras/prj2make-sharp-lib/SlnFileFormat.cs
===================================================================
--- trunk/monodevelop/Extras/prj2make-sharp-lib/SlnFileFormat.cs
2007-09-11 19:57:15 UTC (rev 85655)
+++ trunk/monodevelop/Extras/prj2make-sharp-lib/SlnFileFormat.cs
2007-09-11 20:01:01 UTC (rev 85656)
@@ -538,6 +538,56 @@
combine.Entries.Add (ce);
}
+ //Resolve project references
+ List<ProjectReference> toRemove = new
List<ProjectReference> ();
+ List<ProjectReference> toAdd = new
List<ProjectReference> ();
+ foreach (Project p in combine.GetAllProjects ()) {
+ toRemove.Clear ();
+ toAdd.Clear ();
+ MSBuildData msbuildData = p.ExtendedProperties
[typeof (MSBuildFileFormat)] as MSBuildData;
+ if (msbuildData == null)
+ continue;
+
+ foreach (ProjectReference pref in
p.ProjectReferences) {
+ if (pref.ReferenceType !=
ReferenceType.Project)
+ continue;
+
+ Project rp = combine.FindProject
(pref.Reference);
+ if (rp != null)
+ continue;
+
+ //Unresolved
+ XmlElement elem =
msbuildData.ProjectReferenceElements [pref];
+ if (elem == null)
+ //Should not happen
+ continue;
+
+ if (elem ["Project"] == null)
+ continue;
+
+ string guid = elem
["Project"].InnerText.Trim (new char [] {'{', '}'});
+ if (!combine.ProjectsByGuid.ContainsKey
(guid))
+ continue;
+
+ toRemove.Add (pref);
+ rp = combine.ProjectsByGuid [guid];
+ ProjectReference newRef = new
ProjectReference (ReferenceType.Project, rp.Name);
+ toAdd.Add (newRef);
+
+ XmlElement clonedElement = (XmlElement)
elem.Clone ();
+ elem.ParentNode.InsertAfter
(clonedElement, elem);
+ msbuildData.ProjectReferenceElements
[newRef] = clonedElement;
+ }
+
+ foreach (ProjectReference pref in toRemove) {
+ p.ProjectReferences.Remove (pref);
+
msbuildData.ProjectReferenceElements.Remove (pref);
+ }
+
+ foreach (ProjectReference pref in toAdd)
+ p.ProjectReferences.Add (pref);
+ }
+
//FIXME: This can be just SolutionConfiguration also!
if (globals != null) {
if (globals.Contains
("SolutionConfigurationPlatforms")) {
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches