Browse Source

Update CsprojFileManager.cs

pull/10363/head
Yunus Emre Kalkan 5 years ago
parent
commit
b7cf3c8b8a
  1. 14
      studio/src/Volo.Abp.Studio.Domain.CommonServices/Volo/Abp/Studio/Modifying/CsprojFileManager.cs

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

@ -1,4 +1,5 @@
using System; using System;
using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Xml; using System.Xml;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
@ -13,10 +14,19 @@ namespace Volo.Abp.Studio.Packages.Modifying
{ {
var document = await GetXmlDocumentAsync(filePath); var document = await GetXmlDocumentAsync(filePath);
if (document.SelectNodes($"/Project/ItemGroup/ProjectReference[starts-with(@Include, '{projectToReference}')]").Count > 0) /*if (document.SelectNodes($"/Project/ItemGroup/ProjectReference[ends-with(@Include, '{Path.GetFileName(projectToReference)}')]").Count > 0)
{ {
// Project reference is already added.
return; return;
}*/
var packageReferenceToSameProject =
document.SelectNodes(
$"/Project/ItemGroup/PackageReference[starts-with(@Include, '{Path.GetFileName(projectToReference).RemovePostFix(".csproj")}')]"
);
if (packageReferenceToSameProject.Count > 0)
{
packageReferenceToSameProject[0].ParentNode.RemoveChild(packageReferenceToSameProject[0]);
} }
var relativePath = PathHelper.GetRelativePath(filePath, projectToReference); var relativePath = PathHelper.GetRelativePath(filePath, projectToReference);

Loading…
Cancel
Save