Browse Source

Cli: Modify abpmdl.json files on project creation

pull/10363/head
Yunus Emre Kalkan 5 years ago
parent
commit
405a3e5d0f
  1. 23
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromSolutionStep.cs

23
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveProjectFromSolutionStep.cs

@ -1,6 +1,10 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Volo.Abp.Cli.ProjectBuilding.Files;
namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps
{
@ -35,6 +39,25 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps
var solutionFile = context.GetFile(_solutionFilePath);
solutionFile.NormalizeLineEndings();
solutionFile.SetLines(RemoveProject(solutionFile.GetLines().ToList()));
RemoveProjectFromAbpmdlFile(context);
}
private void RemoveProjectFromAbpmdlFile(ProjectBuildContext context)
{
var abpmdlFile = context.FindFile(_solutionFilePath.RemovePostFix(".sln") + ".abpmdl.json");
if (abpmdlFile == null)
{
return;
}
var jsonRoot = JObject.Parse(abpmdlFile.Content);
var packagesObj = (JObject) jsonRoot["packages"];
packagesObj.Remove(_projectName);
abpmdlFile.SetContent(jsonRoot.ToString(Formatting.Indented));
}
private List<string> RemoveProject(List<string> solutionFileLines)

Loading…
Cancel
Save