Skip to content
This repository has been archived by the owner on Apr 30, 2020. It is now read-only.

Commit

Permalink
Fixed bug with new project files
Browse files Browse the repository at this point in the history
  • Loading branch information
geaz authored Jan 30, 2018
1 parent 45cf468 commit ddf2312
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/Libraries/SharpDox.Build/SDTargetFxParser.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.IO;
using System.Xml;
using System.Xml.Linq;
Expand Down Expand Up @@ -26,13 +26,17 @@ public SDTargetFx GetTargetFx(string projectFile)
else
{
var document = XDocument.Parse(fileContents);

//Try Get TargetFramework for new Project Files
var targetFramework = document.XPathSelectElement("/Project/PropertyGroup/TargetFramework")?.Value;

var targetFrameworkIdentifier = ReadXPathElementValue(document, "/Project/PropertyGroup/TargetFrameworkIdentifier");
var targetFrameworkVersion = ReadXPathElementValue(document, "/Project/PropertyGroup/TargetFrameworkVersion");
var targetPlatformIdentifier = ReadXPathElementValue(document, "/Project/PropertyGroup/TargetPlatformIdentifier");
var targetPlatformVersion = ReadXPathElementValue(document, "/Project/PropertyGroup/TargetPlatformVersion");
var targetFrameworkProfile = ReadXPathElementValue(document, "/Project/PropertyGroup/TargetFrameworkProfile");

targetFx = GetTargetFx(targetFrameworkIdentifier, targetFrameworkVersion, targetPlatformIdentifier, targetPlatformVersion, targetFrameworkProfile);
targetFx = GetTargetFx(targetFramework, targetFrameworkIdentifier, targetFrameworkVersion, targetPlatformIdentifier, targetPlatformVersion, targetFrameworkProfile);
}

return targetFx;
Expand Down Expand Up @@ -64,9 +68,11 @@ private bool IsXamariniOS(string projectFileContents)
return projectFileContents.ToLower().Contains("xamarin.ios.csharp.targets");
}

private SDTargetFx GetTargetFx(string targetFrameworkIdentifier, string targetFrameworkVersion, string targetPlatformIdentifier, string targetPlatformVersion, string targetFrameworkProfile)
private SDTargetFx GetTargetFx(string targetFramework, string targetFrameworkIdentifier, string targetFrameworkVersion,
string targetPlatformIdentifier, string targetPlatformVersion, string targetFrameworkProfile)
{
var targetFx = KnownTargetFxs.Unknown;
var unknownIdentifier = !string.IsNullOrEmpty(targetFramework) ? targetFramework : targetFrameworkIdentifier;
var targetFx = new SDTargetFx { Identifier = unknownIdentifier, Name = unknownIdentifier };

// Note: PCL must be on top (since it also has v4.5)
if (targetFrameworkProfile.ToLower().StartsWith("profile"))
Expand Down Expand Up @@ -132,4 +138,4 @@ private SDTargetFx GetTargetFx(string targetFrameworkIdentifier, string targetFr
return targetFx;
}
}
}
}

0 comments on commit ddf2312

Please sign in to comment.