欢迎光临
我的个人博客网站

WPF .Net Core 3.1遇到Satellite Assemblies无法正常加载的处理


1.原因

加载的时候没有调取

AssemblyLoadContext.Default 

2.解决方案:

在程序启动的时候,手动调用

/// <summary> /// Interaction logic for App.xaml /// </summary> public partial class App : Application {     protected override void OnStartup(StartupEventArgs e)     {         //SetCultureInfo();         LoadSatelliteAssemblies();         base.OnStartup(e);     }      /// <summary>     /// 设置语言/本地化     /// </summary>     private void SetCultureInfo()     {         // Create a new object, representing the German culture.          CultureInfo culture = CultureInfo.CreateSpecificCulture("zh-CN");          // The following line provides localization for the application's user interface.          Thread.CurrentThread.CurrentUICulture = culture;          // The following line provides localization for data formats.          Thread.CurrentThread.CurrentCulture = culture;          // Set this culture as the default culture for all threads in this application.          CultureInfo.DefaultThreadCurrentCulture = culture;         CultureInfo.DefaultThreadCurrentUICulture = culture;      }     /// <summary>     /// 加载程序集上下文,手动调用来查找卫星程序集     /// </summary>     private void LoadSatelliteAssemblies()     {                  //加载程序集上下文,必须         var loadContext = AssemblyLoadContext.Default;         //var arr = loadContext.Assemblies;     } } 

  

参考:

https://docs.microsoft.com/zh-cn/dotnet/core/dependency-loading/loading-resources

 

 

WPF .Net Core 3.1遇到Satellite Assemblies无法正常加载的处理

 

赞(0) 打赏
未经允许不得转载:张拓的天空 » WPF .Net Core 3.1遇到Satellite Assemblies无法正常加载的处理
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

专业的IT技术经验分享 更专业 更方便

联系我们本站主机

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏