2020-07-22

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无法正常加载的处理worldfirst华翰物流墩煌网(精品分析)亚马逊英国站高尔夫测距仪类目市场调查数据报告卖家注意,亚马逊广告新增三大功能!如何建设并运营好独立站?谨记6大要素!布拉格:记忆中的波希米亚(组图)(2)美国内达华州:博物馆里的文明印迹(7)千岛湖旅游攻略_杭州攻略

No comments:

Post a Comment