mirror of https://github.com/abpframework/abp.git
committed by
GitHub
7 changed files with 138 additions and 12 deletions
@ -0,0 +1,34 @@ |
|||||
|
using System; |
||||
|
using System.Linq; |
||||
|
using System.Xml; |
||||
|
using Volo.Abp.Cli.ProjectBuilding.Building; |
||||
|
using Volo.Abp.Cli.Utils; |
||||
|
|
||||
|
namespace Volo.Abp.Cli.ProjectBuilding.Templates.App; |
||||
|
|
||||
|
public class MauiBlazorChangeApplicationIdGuidStep: ProjectBuildPipelineStep |
||||
|
{ |
||||
|
public override void Execute(ProjectBuildContext context) |
||||
|
{ |
||||
|
var projectFile = context.Files.FirstOrDefault(f => f.Name.EndsWith("MyCompanyName.MyProjectName.MauiBlazor.csproj")); |
||||
|
|
||||
|
if (projectFile == null) |
||||
|
{ |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
using (var stream = StreamHelper.GenerateStreamFromString(projectFile.Content)) |
||||
|
{ |
||||
|
var doc = new XmlDocument { PreserveWhitespace = true }; |
||||
|
doc.Load(stream); |
||||
|
|
||||
|
var node = doc.SelectSingleNode("/Project/PropertyGroup/ApplicationIdGuid"); |
||||
|
if (node != null) |
||||
|
{ |
||||
|
node.InnerText = Guid.NewGuid().ToString(); |
||||
|
} |
||||
|
|
||||
|
projectFile.SetContent(doc.OuterXml); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,50 @@ |
|||||
|
using System; |
||||
|
using System.Linq; |
||||
|
using Volo.Abp.Cli.ProjectBuilding.Building; |
||||
|
|
||||
|
namespace Volo.Abp.Cli.ProjectBuilding.Templates.App; |
||||
|
|
||||
|
public class MauiBlazorPortChangeForSeparatedAuthServersStep: ProjectBuildPipelineStep |
||||
|
{ |
||||
|
public override void Execute(ProjectBuildContext context) |
||||
|
{ |
||||
|
|
||||
|
var appsettingsFile = context.Files.FirstOrDefault(x => |
||||
|
!x.IsDirectory && |
||||
|
x.Name.EndsWith("aspnet-core/src/MyCompanyName.MyProjectName.MauiBlazor/appsettings.json", |
||||
|
StringComparison.InvariantCultureIgnoreCase) |
||||
|
); |
||||
|
|
||||
|
if(appsettingsFile == null) |
||||
|
{ |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
appsettingsFile.NormalizeLineEndings(); |
||||
|
var lines = appsettingsFile.GetLines(); |
||||
|
|
||||
|
for (var i = 1; i < lines.Length; i++) |
||||
|
{ |
||||
|
var line = lines[i]; |
||||
|
|
||||
|
var previousLine = lines[i-1]; |
||||
|
|
||||
|
if (line.Contains("Authority") && line.Contains("localhost")) |
||||
|
{ |
||||
|
line = line.Replace("44305", "44301"); |
||||
|
} |
||||
|
else if (previousLine.Contains("AbpAccountPublic") && line.Contains("BaseUrl") && line.Contains("localhost")) |
||||
|
{ |
||||
|
line = line.Replace("44305", "44301"); |
||||
|
} |
||||
|
else if (previousLine.Contains("Default") && line.Contains("BaseUrl") && line.Contains("localhost")) |
||||
|
{ |
||||
|
line = line.Replace("44305", "44300"); |
||||
|
} |
||||
|
|
||||
|
lines[i] = line; |
||||
|
} |
||||
|
|
||||
|
appsettingsFile.SetLines(lines); |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue