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

dev*_*xer 7 wpf xaml resourcedictionary

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

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

<ResourceDictionary.MergedDictionaries>
    <ResourceDictionary
        Source="/PresentationFramework.Aero;component/themes/Aero.NormalColor.xaml" />
    <ResourceDictionary
        Source="pack://application:,,,/WPFToolkit;component/Themes/Aero.NormalColor.xaml" />
</ResourceDictionary.MergedDictionaries>
Run Code Online (Sandbox Code Playgroud)

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


这是我得到的确切错误:

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

dev*_*xer 7

原来我只需要在我的第一个ResourceDictionary声明中添加一些细节:

<ResourceDictionary
    Source="/PresentationFramework.Aero, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL;component/themes/aero.normalcolor.xaml" />
Run Code Online (Sandbox Code Playgroud)