Browse Source

Merge pull request #10569 from abpframework/berkan/fix-blazor-server-bundle-problem

`abp add-module` command doesn't work for `blazor-server` project
pull/10578/head
maliming 5 years ago
committed by GitHub
parent
commit
81f863a168
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      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

13
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,21 @@ namespace Volo.Abp.Cli.Bundling
{
var document = new XmlDocument();
document.Load(projectFilePath);
return document.SelectSingleNode("//TargetFramework").InnerText;
}
private void CheckProjectIsSupportedType(string projectFilePath)
{
var document = new XmlDocument();
document.Load(projectFilePath);
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