我有一个项目引用了两个dll。如果引用的dll不是强的,那么命名资源是很好的,我的用户控件可以工作。问题是我必须强命名引用的DLL,现在我的用户控件给我一个内部为“无法加载文件或程序集”的XamlParseException System.Windows.Markup.StaticResourceHolder。我猜无法找到或加载app.xaml中的静态资源,因此它认为程序集没有加载。有办法绕道吗?
App.Xaml...
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Dark.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Grey.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Red.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>App.xaml.cs...
public partial class App
{
protected override void OnStartup(StartupEventArgs e)
{
// referenced to MaterialDesignThemes.Wpf
MaterialDesignThemes.Wpf.DialogHost d = new MaterialDesignThemes.Wpf.DialogHost();
var b = d.IsOpen;
base.OnStartup(e);
var app = new MainWindow();
var context = new MainWindowVM();
app.DataContext = context;
app.Show();
}
}发布于 2018-11-26 03:22:59
您可以启用融合日志记录,并从此日志文件中获得提示。如何在.NET中启用程序集绑定故障日志记录(融合)
发布于 2018-11-25 19:05:11
pack://application:,,,/MaterialDesignThemes.Wpf;component -- "MaterialDesignThemes.Wpf“是您程序集的名称吗?还是命名空间?
是否可以尝试使用程序集(dll)名称作为参考?有关更多细节,请访问包URI。
https://stackoverflow.com/questions/53468922
复制相似问题