Browse Source

fix(Abp-Cli): `add-module` command doesn't work for `blazor-server` project

`abp bundle` command only support blazor-wasm project.
pull/10569/head
Berkan Sasmaz 5 years ago
parent
commit
2fdbb3e9c0
  1. 18
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/BundlingService.cs
  2. 10
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs

18
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/BundlingService.cs

@ -39,6 +39,8 @@ namespace Volo.Abp.Cli.Bundling
}
var projectFilePath = projectFiles[0];
CheckProjectIsSupportedType(projectFilePath);
var config = ConfigReader.Read(PathHelper.GetWwwRootPath(directory));
var bundleConfig = config.Bundle;
@ -282,14 +284,26 @@ namespace Volo.Abp.Cli.Bundling
{
var document = new XmlDocument();
document.Load(projectFilePath);
CheckProjectIsSupportedType(document);
return document.SelectSingleNode("//TargetFramework").InnerText;
}
private void CheckProjectIsSupportedType(string projectFilePath)
{
var document = new XmlDocument();
document.Load(projectFilePath);
CheckProjectIsSupportedType(document);
}
private void CheckProjectIsSupportedType(XmlDocument document)
{
var sdk = document.DocumentElement.GetAttribute("Sdk");
if (sdk != BundlingConsts.SupportedWebAssemblyProjectType)
{
throw new BundlingException(
$"Unsupported project type. Project type must be {BundlingConsts.SupportedWebAssemblyProjectType}.");
}
return document.SelectSingleNode("//TargetFramework").InnerText;
}
}
}

10
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs

@ -7,8 +7,10 @@ using System.IO;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using System.Xml;
using NuGet.Versioning;
using Volo.Abp.Cli.Args;
using Volo.Abp.Cli.Bundling;
using Volo.Abp.Cli.Commands;
using Volo.Abp.Cli.Commands.Services;
using Volo.Abp.Cli.Http;
@ -184,6 +186,14 @@ namespace Volo.Abp.Cli.ProjectModification
{
return;
}
// return if project is blazor-server
var document = new XmlDocument();
document.Load(blazorProject);
var sdk = document.DocumentElement.GetAttribute("Sdk");
if (sdk != BundlingConsts.SupportedWebAssemblyProjectType)
{
return;
}
var args = new CommandLineArgs("bundle");

Loading…
Cancel
Save