diff --git a/Oqtane.Client/Program.cs b/Oqtane.Client/Program.cs index 8a1fd2b8..f0218d64 100644 --- a/Oqtane.Client/Program.cs +++ b/Oqtane.Client/Program.cs @@ -1,19 +1,18 @@ -using Microsoft.AspNetCore.Components.WebAssembly.Hosting; -using Microsoft.Extensions.DependencyInjection; -using System.Threading.Tasks; -using Oqtane.Services; -using System.Reflection; -using System; +using System; using System.Collections.Generic; +using System.IO; +using System.IO.Compression; using System.Linq; using System.Net.Http; -using System.Net.Http.Json; -using Oqtane.Modules; -using Oqtane.Shared; -using Oqtane.Providers; +using System.Reflection; +using System.Threading.Tasks; using Microsoft.AspNetCore.Components.Authorization; -using System.IO.Compression; -using System.IO; +using Microsoft.AspNetCore.Components.WebAssembly.Hosting; +using Microsoft.Extensions.DependencyInjection; +using Oqtane.Modules; +using Oqtane.Providers; +using Oqtane.Shared; +using Oqtane.Services; namespace Oqtane.Client { @@ -101,8 +100,8 @@ namespace Oqtane.Client // asemblies and debug symbols are packaged in a zip file using (ZipArchive archive = new ZipArchive(new MemoryStream(zip))) { - Dictionary dlls = new Dictionary(); - Dictionary pdbs = new Dictionary(); + var dlls = new Dictionary(); + var pdbs = new Dictionary(); foreach (ZipArchiveEntry entry in archive.Entries) { @@ -115,7 +114,15 @@ namespace Oqtane.Client switch (Path.GetExtension(entry.Name)) { case ".dll": - dlls.Add(entry.Name, file); + // Loads the stallite assemblies early + if (entry.Name.EndsWith(Constants.StalliteAssemblyExtension)) + { + Assembly.Load(entry.Name); + } + else + { + dlls.Add(entry.Name, file); + } break; case ".pdb": pdbs.Add(entry.Name, file); diff --git a/Oqtane.Server/Extensions/OqtaneServiceCollectionExtensions.cs b/Oqtane.Server/Extensions/OqtaneServiceCollectionExtensions.cs index b274faa5..a51595ca 100644 --- a/Oqtane.Server/Extensions/OqtaneServiceCollectionExtensions.cs +++ b/Oqtane.Server/Extensions/OqtaneServiceCollectionExtensions.cs @@ -8,6 +8,7 @@ using Oqtane.Infrastructure; using Oqtane.Infrastructure.Localization; using Oqtane.Modules; using Oqtane.Services; +using Oqtane.Shared; using Oqtane.UI; // ReSharper disable once CheckNamespace @@ -15,8 +16,6 @@ namespace Microsoft.Extensions.DependencyInjection { public static class OqtaneServiceCollectionExtensions { - private static readonly string StalliteAssemblyExtension = ".resources.dll"; - public static IServiceCollection AddOqtane(this IServiceCollection services, Runtime runtime) { LoadAssemblies(); @@ -138,7 +137,7 @@ namespace Microsoft.Extensions.DependencyInjection foreach (var culture in LocalizationSettings.SupportedCultures) { var assembliesFolder = new DirectoryInfo(Path.Combine(assemblyPath, culture)); - foreach (var assemblyFile in assembliesFolder.EnumerateFiles(StalliteAssemblyExtension)) + foreach (var assemblyFile in assembliesFolder.EnumerateFiles(Constants.StalliteAssemblyExtension)) { AssemblyName assemblyName; try diff --git a/Oqtane.Shared/Shared/Constants.cs b/Oqtane.Shared/Shared/Constants.cs index c237857d..7b9b3a0e 100644 --- a/Oqtane.Shared/Shared/Constants.cs +++ b/Oqtane.Shared/Shared/Constants.cs @@ -57,5 +57,7 @@ namespace Oqtane.Shared (Char) 28, (Char) 29, (Char) 30, (Char) 31, ':', '*', '?', '\\', '/' }; public static readonly string[] InvalidFileNameEndingChars = { ".", " " }; + + public static readonly string StalliteAssemblyExtension = ".resources.dll"; } }