Browse Source
Refactor assembly file path retrieval in BundlingService and simplify string comparison in PathHelper
pull/22731/head
maliming
1 year ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
2 changed files with
4 additions and
2 deletions
-
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/BundlingService.cs
-
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Bundling/PathHelper.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."); |
|
|
|
|
|
|
|
@ -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)); |
|
|
|
} |
|
|
|
|
|
|
|
|