Browse Source

Fixed SD2-492: VS.NET solution converter ignores HintPath attribute for references.

Fixed SD2-491: Solution converter doesn't convert references correctly.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@588 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
93c191ed25
  1. 10
      data/ConversionStyleSheets/vsnet2msbuild.xsl
  2. 5
      src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionLoader.cs
  3. 4
      src/Main/Base/Project/Src/Project/Converter/PrjxToSolutionProject.cs
  4. 3
      src/Main/Base/Project/Src/TextEditor/Gui/Dialogs/GotoDialog.cs
  5. 17
      src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs

10
data/ConversionStyleSheets/vsnet2msbuild.xsl

@ -47,9 +47,9 @@ @@ -47,9 +47,9 @@
</xsl:for-each>
<xsl:element name = "ItemGroup">
<xsl:for-each select="Build/References/Reference[@HintPath]">
<xsl:for-each select="Build/References/Reference[@AssemblyName]">
<xsl:element name = "Reference" >
<xsl:attribute name = "Include"><xsl:value-of select = "@Name" /></xsl:attribute>
<xsl:attribute name = "Include"><xsl:value-of select = "@AssemblyName" /></xsl:attribute>
<xsl:if test="Conversion:IsNotGacReference(@HintPath)">
<xsl:element name = "HintPath" ><xsl:value-of select = "@HintPath" /></xsl:element>
<xsl:element name = "Private" ><xsl:value-of select = "@Private" /></xsl:element>
@ -78,7 +78,11 @@ @@ -78,7 +78,11 @@
</xsl:element>
<xsl:element name = "ItemGroup">
<!-- Directories -->
<xsl:for-each select="Build/Imports/Import">
<xsl:element name = "Import" >
<xsl:attribute name = "Include"><xsl:value-of select = "@Namespace" /></xsl:attribute>
</xsl:element>
</xsl:for-each>
</xsl:element>
<xsl:element name = "ItemGroup">

5
src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionLoader.cs

@ -45,7 +45,10 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -45,7 +45,10 @@ namespace ICSharpCode.SharpDevelop.Dom
return new ReflectionProjectContent(assembly, fileName);
}
assembly = ProjectContentRegistry.LoadGACAssembly(include, true);
return new ReflectionProjectContent(assembly);
if (assembly != null)
return new ReflectionProjectContent(assembly);
else
return null;
} catch (BadImageFormatException) {
LoggingService.Warn("BadImageFormat: " + include);
return null;

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

@ -50,7 +50,9 @@ namespace ICSharpCode.SharpDevelop.Project.Converter @@ -50,7 +50,9 @@ namespace ICSharpCode.SharpDevelop.Project.Converter
public bool IsNotGacReference(string hintPath)
{
return FileUtility.IsBaseDirectory(FileUtility.NETFrameworkInstallRoot, hintPath);
if (hintPath == null || hintPath.Length == 0)
return false;
return !FileUtility.IsBaseDirectory(FileUtility.NETFrameworkInstallRoot, hintPath);
}
string rootNamespace;

3
src/Main/Base/Project/Src/TextEditor/Gui/Dialogs/GotoDialog.cs

@ -275,6 +275,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -275,6 +275,7 @@ namespace ICSharpCode.SharpDevelop.Gui
ArrayList SearchClasses(string text)
{
string lowerText = text.ToLowerInvariant();
ArrayList list = new ArrayList();
if (ProjectService.OpenSolution != null) {
foreach (IProject project in ProjectService.OpenSolution.Projects) {
@ -283,7 +284,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -283,7 +284,7 @@ namespace ICSharpCode.SharpDevelop.Gui
foreach (IClass c in projectContent.Classes) {
string className = c.Name;
if (className.Length >= text.Length) {
if (text.Equals(className.Substring(0, text.Length), StringComparison.OrdinalIgnoreCase)) {
if (className.ToLowerInvariant().IndexOf(lowerText) >= 0) {
list.Add(c);
}
}

17
src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs

@ -187,14 +187,17 @@ namespace ICSharpCode.Core @@ -187,14 +187,17 @@ namespace ICSharpCode.Core
public static bool IsBaseDirectory(string baseDirectory, string testDirectory)
{
try {
baseDirectory = Path.GetFullPath(baseDirectory.ToUpper());
testDirectory = Path.GetFullPath(testDirectory.ToUpper());
baseDirectory = Path.GetFullPath(baseDirectory).ToUpperInvariant();
testDirectory = Path.GetFullPath(testDirectory).ToUpperInvariant();
baseDirectory = baseDirectory.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
testDirectory = testDirectory.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
return baseDirectory.Length <= testDirectory.Length &&
testDirectory.StartsWith(baseDirectory) &&
(testDirectory.Length == baseDirectory.Length ||
testDirectory[baseDirectory.Length] == Path.DirectorySeparatorChar ||
testDirectory[baseDirectory.Length] == Path.AltDirectorySeparatorChar);
if (baseDirectory[baseDirectory.Length - 1] != Path.DirectorySeparatorChar)
baseDirectory += Path.DirectorySeparatorChar;
if (testDirectory[testDirectory.Length - 1] != Path.DirectorySeparatorChar)
testDirectory += Path.DirectorySeparatorChar;
return testDirectory.StartsWith(baseDirectory);
} catch (Exception) {
return false;
}

Loading…
Cancel
Save