diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/BundlingService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/BundlingService.cs index 74be59e014..9cce1cd734 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/BundlingService.cs +++ b/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; } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs index cf1e9a3687..affb89771f 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs +++ b/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");