Skip to content

Commit

Permalink
Fix improvement which also addresses .NET MAUI project support issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
imcarolwang committed Aug 30, 2022
1 parent 874bb54 commit 1207a0c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
6 changes: 0 additions & 6 deletions src/dotnet-svcutil/lib/src/Shared/MSBuildProj.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,6 @@ public static async Task<MSBuildProj> ParseAsync(string projectText, string proj
var targetFramework = targetFrameworkElements.Last().Value.Trim().ToLowerInvariant();
if (!string.IsNullOrWhiteSpace(targetFramework))
{
var tfx = targetFramework.Split('-');
if (tfx.Length > 1 && (tfx[0] == "net5.0" || tfx[0] == "net6.0"))
{
targetFramework = tfx[0];
}

msbuildProj._targetFrameworks.Add(targetFramework);
}
}
Expand Down
13 changes: 12 additions & 1 deletion src/dotnet-svcutil/lib/src/Shared/TargetFrameworkHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public static IEnumerable<ProjectDependency> GetWcfProjectReferences(string targ
public static string GetBestFitTargetFramework(IEnumerable<string> targetFrameworks)
{
string targetFramework = string.Empty;
FrameworkInfo fxInfo;
FrameworkInfo fxInfo = null;

if (targetFrameworks != null)
{
Expand All @@ -147,6 +147,11 @@ public static string GetBestFitTargetFramework(IEnumerable<string> targetFramewo
}
}

if (fxInfo != null)
{
return fxInfo.FullName;
}

return targetFramework;
}

Expand Down Expand Up @@ -204,6 +209,12 @@ public static bool IsSupportedFramework(string fullFrameworkName, out FrameworkI
{
bool isSupported = false;

var tfx = fullFrameworkName.Split('-');
if (tfx.Length > 1)
{
fullFrameworkName = tfx[0];
}

if (FrameworkInfo.TryParse(fullFrameworkName, out frameworkInfo))
{
isSupported = (frameworkInfo.Name == FrameworkInfo.Netstandard && frameworkInfo.Version >= MinSupportedNetStandardVersion) ||
Expand Down

0 comments on commit 1207a0c

Please sign in to comment.