WPF 可执行文件不会在 Visual Studio 之外运行(资源字典问题)

标签 wpf xaml resourcedictionary

我有一个 WPF 应用程序,如果我在 Visual Studio 中“调试”(F5)(调试和 Release模式都可以工作),它可以很好地工作,但是如果我尝试双击 bin\Release 文件夹中的 .exe,Windows 会终止该应用程序立即地。

问题似乎是可执行文件找不到“PresentationFramework.Aero”,我将其添加到我的应用程序的资源字典中,如下所示:

<ResourceDictionary.MergedDictionaries>
    <ResourceDictionary
        Source="/PresentationFramework.Aero;component/themes/Aero.NormalColor.xaml" />
    <ResourceDictionary
        Source="pack://application:,,,/WPFToolkit;component/Themes/Aero.NormalColor.xaml" />
</ResourceDictionary.MergedDictionaries>

包含 Aero 主题(或指向它)以便我可以发布我的应用程序的正确方法是什么?

这是我得到的确切错误:

Could not load file or assembly 'PresentationFramework.Aero, Culture=neutral' or one of its dependencies. The system cannot find the file specified.":"PresentationFramework.Aero, Culture=neutral

最佳答案

结果我只需要在我的第一个 ResourceDictionary 中添加一些细节宣言:

<ResourceDictionary
    Source="/PresentationFramework.Aero, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL;component/themes/aero.normalcolor.xaml" />

关于WPF 可执行文件不会在 Visual Studio 之外运行(资源字典问题),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3249860/

相关文章:

wpf - 使用 WPF 将 ObservableCollection.Count 绑定(bind)到标签

wpf - WPF中能否将多个xps文档合并为一个?

xaml - 如何将 Button 的 IsEnabled 成员绑定(bind)到 TextBox 的内容?

wpf - 绑定(bind)为资源

xaml - Xamarin Form - 如何在 ResourceDictionary 中更改 TabbedPage 标题字体大小

wpf - 在 DataTemplate 中显示和聚焦 TextBox

c# - 从 ViewModel 关闭窗口

wpf - 在 WPF 中更改标签的样式和模板

c# - Windows Phone 8 - 小循环模板动态磁贴 (159x159)

c# - 如何从其隐藏代码访问资源字典中的控件?