2014-07-15 42 views
1

根据this topic,您可以将MahApps.Metro.dllSystem.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文件夹中,并在我的项目中引用它们。

回答

0

好吧,我自己发现了这个问题。 这似乎是Assembly NameDefault Namespace(项目菜单 - >属性)必须准确相同。矿是不同的,大会名称包含'!'它在默认命名空间中用'_'取代,从而产生这个错误。

编译后,您可以重命名您的应用程序。