我有一个 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/