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 20 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 @@ @@ -88,7 +88,7 @@
<xsl:element name = "ItemGroup">
<xsl:for-each select="Build/References/Reference[@Project]">
<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 = "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; @@ -13,6 +13,7 @@ using System.IO;
using System.Xml;
using System.Xml.XPath;
using System.Xml.Xsl;
using System.Windows.Forms;
using ICSharpCode.Core;
@ -27,6 +28,8 @@ namespace ICSharpCode.SharpDevelop.Project.Converter @@ -27,6 +28,8 @@ namespace ICSharpCode.SharpDevelop.Project.Converter
{
public Dictionary<string, Guid> NameToGuid = new Dictionary<string, Guid>();
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 List<string> Resources;
@ -40,14 +43,43 @@ namespace ICSharpCode.SharpDevelop.Project.Converter @@ -40,14 +43,43 @@ namespace ICSharpCode.SharpDevelop.Project.Converter
public string GetGuid(string name)
{
return "{" + NameToGuid[name].ToString().ToUpper() + "}";
return "{" + NameToGuid[name].ToString().ToUpperInvariant() + "}";
}
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 "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)
{
if (hintPath == null || hintPath.Length == 0)

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

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

Loading…
Cancel
Save