Browse Source

Refactor assembly file path retrieval in BundlingService and simplify string comparison in PathHelper

pull/22731/head
maliming 1 year ago
parent
commit
84c1f7ee45
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 4
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/BundlingService.cs
  2. 2
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/PathHelper.cs

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

@ -66,7 +66,9 @@ public class BundlingService : IBundlingService, ITransientDependency
var frameworkVersion = GetTargetFrameworkVersion(projectFilePath, projectType);
var projectName = Path.GetFileNameWithoutExtension(projectFilePath);
var assemblyFilePath = projectType == BundlingConsts.WebAssembly? PathHelper.GetWebAssemblyFilePath(directory, frameworkVersion, projectName) : PathHelper.GetMauiBlazorAssemblyFilePath(directory, projectName);
var assemblyFilePath = projectType == BundlingConsts.WebAssembly
? PathHelper.GetWebAssemblyFilePath(directory, frameworkVersion, projectName)
: PathHelper.GetMauiBlazorAssemblyFilePath(directory, projectName);
if (assemblyFilePath == null)
{
throw new BundlingException("No assembly file found. Please build the project first.");

2
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/PathHelper.cs

@ -21,7 +21,7 @@ static internal class PathHelper
static internal string GetMauiBlazorAssemblyFilePath(string directory, string projectFileName)
{
return Directory.GetFiles(directory, "*.dll", SearchOption.AllDirectories).FirstOrDefault(f =>
!f.Contains("android", StringComparison.OrdinalIgnoreCase) &&
!f.Contains("android") &&
f.EndsWith(projectFileName + ".dll", StringComparison.OrdinalIgnoreCase));
}

Loading…
Cancel
Save