WPF可执行文件在Visual Studio外无法运行(资源字典问题)

7
我有一个WPF应用程序,在Visual Studio中“调试”(F5)时工作得非常好(Debug和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主题,以便我能发布我的应用程序?


这就是我得到的精确错误信息:

无法加载文件或程序集“PresentationFramework.Aero, Culture=neutral”或其一个依赖项。系统找不到指定的文件。:“PresentationFramework.Aero, Culture=neutral”

1个回答

7
结果证明,我只需要在第一个ResourceDictionary声明中添加一些细节即可:
<ResourceDictionary
    Source="/PresentationFramework.Aero, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL;component/themes/aero.normalcolor.xaml" />

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接