Browse Source

Fixed SD2-477: Solution import error.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@589 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 21 years ago
parent
commit
e7bbee281b
  1. 2
      data/ConversionStyleSheets/vsnet2msbuild.xsl
  2. 34
      src/Main/Base/Project/Src/Project/Converter/PrjxToSolutionProject.cs
  3. 1
      src/Main/Base/Project/Src/Project/Solution/Solution.cs

2
data/ConversionStyleSheets/vsnet2msbuild.xsl

@ -88,7 +88,7 @@
<xsl:element name = "ItemGroup"> <xsl:element name = "ItemGroup">
<xsl:for-each select="Build/References/Reference[@Project]"> <xsl:for-each select="Build/References/Reference[@Project]">
<xsl:element name = "ProjectReference" > <xsl:element name = "ProjectReference" >
<xsl:attribute name = "Include"><xsl:value-of select = "Conversion:GetRelativeProjectPath(@Name)" /></xsl:attribute> <xsl:attribute name = "Include"><xsl:value-of select = "Conversion:GetRelativeProjectPathByGuid(@Name, @Project)" /></xsl:attribute>
<xsl:element name = "Project"><xsl:value-of select = "@Project" /></xsl:element> <xsl:element name = "Project"><xsl:value-of select = "@Project" /></xsl:element>
<xsl:element name = "Name"><xsl:value-of select = "@Name" /></xsl:element> <xsl:element name = "Name"><xsl:value-of select = "@Name" /></xsl:element>

34
src/Main/Base/Project/Src/Project/Converter/PrjxToSolutionProject.cs

@ -13,6 +13,7 @@ using System.IO;
using System.Xml; using System.Xml;
using System.Xml.XPath; using System.Xml.XPath;
using System.Xml.Xsl; using System.Xml.Xsl;
using System.Windows.Forms;
using ICSharpCode.Core; using ICSharpCode.Core;
@ -27,6 +28,8 @@ namespace ICSharpCode.SharpDevelop.Project.Converter
{ {
public Dictionary<string, Guid> NameToGuid = new Dictionary<string, Guid>(); public Dictionary<string, Guid> NameToGuid = new Dictionary<string, Guid>();
public Dictionary<string, string> NameToPath = new Dictionary<string, string>(); public Dictionary<string, string> NameToPath = new Dictionary<string, string>();
/// <summary>only in VS03 -&gt; MSBuild conversion</summary>
public Dictionary<Guid, string> GuidToPath = new Dictionary<Guid, string>();
public bool IsVisualBasic; public bool IsVisualBasic;
public List<string> Resources; public List<string> Resources;
@ -40,13 +43,42 @@ namespace ICSharpCode.SharpDevelop.Project.Converter
public string GetGuid(string name) public string GetGuid(string name)
{ {
return "{" + NameToGuid[name].ToString().ToUpper() + "}"; return "{" + NameToGuid[name].ToString().ToUpperInvariant() + "}";
} }
public string GetRelativeProjectPath(string name) public string GetRelativeProjectPath(string name)
{ {
if (!NameToPath.ContainsKey(name)) {
if (MessageService.AskQuestion("Project reference to " + name + " could not be resolved.\n" +
"Do you want to specify it manually?")) {
using (OpenFileDialog dlg = new OpenFileDialog()) {
dlg.Title = "Find " + name;
dlg.InitialDirectory = basePath;
dlg.Filter = "SharpDevelop 1.x project|*.prjx";
if (dlg.ShowDialog() == DialogResult.OK) {
NameToPath[name] = dlg.FileName;
NameToGuid[name] = Guid.NewGuid();
return FileUtility.GetRelativePath(basePath, NameToPath[name]); return FileUtility.GetRelativePath(basePath, NameToPath[name]);
} }
}
}
return "NotFound." + name + ".proj";
}
return FileUtility.GetRelativePath(basePath, NameToPath[name]);
}
public string GetRelativeProjectPathByGuid(string name, string guidText)
{
if (!NameToPath.ContainsKey(name)) {
Guid guid = new Guid(guidText);
if (!GuidToPath.ContainsKey(guid)) {
MessageService.ShowWarning("Project reference to " + name + " could not be resolved.");
return "NotFound." + name + ".proj";
}
return GuidToPath[guid];
}
return NameToPath[name];
}
public bool IsNotGacReference(string hintPath) public bool IsNotGacReference(string hintPath)
{ {

1
src/Main/Base/Project/Src/Project/Solution/Solution.cs

@ -400,6 +400,7 @@ namespace ICSharpCode.SharpDevelop.Project
string guid = match.Result("${Guid}"); string guid = match.Result("${Guid}");
conversion.NameToGuid.Add(title, new Guid(guid)); conversion.NameToGuid.Add(title, new Guid(guid));
conversion.NameToPath.Add(title, location); conversion.NameToPath.Add(title, location);
conversion.GuidToPath.Add(new Guid(guid), location);
} }
} }
return version; return version;

Loading…
Cancel
Save