根据this topic,您可以将MahApps.Metro.dll
和System.Windows.Interactivity.dll
嵌入到您的项目中,并将它们捆绑到1个exe文件中。 不幸的是,这会导致Program.cs中的App.Main();
出现异常。绑定MahApps.Metro DLL导致System.Windows.Markup.XamlParseException
System.Windows.Markup.XamlParseException在PresentationFramework.dll
附加信息:行号 “8” 和位置 “18” System.Windows.ResourceDictionary.Source
我抬头demo-project只能找到与我已有的完全相同的项目设置。 想抓住的InnerException:
System.IO.FileNotFoundException:找不到文件或程序集 “MahApps.Metro,文化=中性” 找不到
Dateiname: 'MahApps.Metro, Culture=neutral'
bei System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
bei System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
bei System.Reflection.Assembly.Load(AssemblyName assemblyRef)
bei System.Windows.Navigation.BaseUriHelper.GetLoadedAssembly(String assemblyName, String assemblyVersion, String assemblyKey)
bei MS.Internal.AppModel.ResourceContainer.GetResourceManagerWrapper(Uri uri, String& partName, Boolean& isContentFile)
bei MS.Internal.AppModel.ResourceContainer.GetPartCore(Uri uri)
bei System.IO.Packaging.Package.GetPart(Uri partUri)
bei System.IO.Packaging.PackWebResponse.CachedResponse.GetResponseStream()
bei System.IO.Packaging.PackWebResponse.get_ContentType()
bei MS.Internal.WpfWebRequestHelper.GetContentType(WebResponse response)
bei MS.Internal.WpfWebRequestHelper.GetResponseStream(WebRequest request, ContentType& contentType)
bei System.Windows.ResourceDictionary.set_Source(Uri value)
bei MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(Object inst, XamlMember property, Object value)
只是为了清楚,我复制了2个dll构成演示项目,并将它们粘贴到另一个extern“lib”文件夹中,然后将它们添加到作为链接的实习生DllsAsResource
文件夹中,并在我的项目中引用它们。