Browse Source

Added CsprojFileManager.GetTargetFrameworkAsync

pull/10363/head
Yunus Emre Kalkan 4 years ago
parent
commit
055a5186f7
  1. 14
      studio/src/Volo.Abp.Studio.Domain.CommonServices/Volo/Abp/Studio/Modifying/CsprojFileManager.cs
  2. 2
      studio/src/Volo.Abp.Studio.Domain.CommonServices/Volo/Abp/Studio/Modifying/ICsprojFileManager.cs

14
studio/src/Volo.Abp.Studio.Domain.CommonServices/Volo/Abp/Studio/Modifying/CsprojFileManager.cs

@ -103,6 +103,20 @@ namespace Volo.Abp.Studio.Packages.Modifying
await SaveXmlDocumentAsync(filePath, document);
}
public async Task<string> GetTargetFrameworkAsync(string filePath)
{
var document = await GetXmlDocumentAsync(filePath);
var nodes = document["PropertyGroup"].SelectNodes("TargetFramework");
if (nodes.Count == 0)
{
return null;
}
return nodes[0].InnerText.Trim();
}
private XmlNode GetOrCreateItemGroupNode(XmlDocument document)
{
var nodes = document["Project"].SelectNodes("ItemGroup");

2
studio/src/Volo.Abp.Studio.Domain.CommonServices/Volo/Abp/Studio/Modifying/ICsprojFileManager.cs

@ -9,5 +9,7 @@ namespace Volo.Abp.Studio.Packages.Modifying
Task AddPackageReferenceAsync(string filePath, string packageName, string version);
Task ConvertPackageReferenceToProjectReferenceAsync(string filePath, string projectToReference);
Task<string> GetTargetFrameworkAsync(string filePath);
}
}

Loading…
Cancel
Save