为什么无法在Windows 7加载程序集presentationFramework.Aero2?加载、程序、Windows、presentationFramework

2023-09-04 01:08:53 作者:︵St〇p戀﹏

最近,我完成了我的第一个WPF应用程序使用Windows 8.一直很好我的机器上我一直在开发。我的一个朋友跑了它在其Windows 8的机器视觉工作室为好,而且工作。我用点击一次,我的机器上安装该程序,并安装罚款并运行。

我安装了Windows 7的虚拟框,并试图用点击一次安装它。它取.NET 4.5和SQL Server Compact,安装过程似乎无懈可击。当Windows 7试图运行的应用程序,没有什么有用的事情发生了。我在VirtualBox中安装了Visual Studio,并能得到这个堆栈跟踪。

我抬头看了看presentationFramework.Aero2对谷歌和碰到3 SO问题,一个MSDN的问题。在MSDN的问题给了我什么,我想这可能是一个暗示。如果我去到C:\ WINDOWS \ Microsoft.NET \框架\ 4.0 \ WPF没有presentationFramework.Aero2.dll文件,而在Windows 8中,...所以我复制并粘贴到Windows 7的相当于地方希望能实现的东西,但无疾而终。

下面是堆栈跟踪:

  System.Windows.Markup.XamlParseException是未处理
  HResult的= -2146233087
  消息='添加价值集合类型System.Collections.ObjectModel.ObservableCollection(System.Windows.Controls.DataGridColumn)引发了异常。行号'35'和线位置'71'。
  来源= presentationFramework
  行号= 35
  LinePosition = 71
  堆栈跟踪:
       在System.Windows.Markup.WpfXamlLoader.Load(的XamlReader的XamlReader,IXamlObjectWriterFactory writerFactory,布尔skipJournaledProperties,对象rootObject,XamlObjectWriterSettings设置,开放的基本URI)
       在System.Windows.Markup.WpfXamlLoader.LoadBaml(的XamlReader的XamlReader,布尔skipJournaledProperties,对象rootObject,XamlAccessLevel ACCESSLEVEL,乌里基本URI)
       在System.Windows.Markup.XamlReader.LoadBaml(流流,ParserContext parserContext,对象父,布尔closeStream)
       在System.Windows.Application.LoadBamlStreamWithSyncInfo(流流,ParserContext PC)
       在System.Windows.Application.LoadComponent(URI resourceLocator,布尔bSkipJournaledProperties)
       在System.Windows.Application.DoStartup()
       在System.Windows.Application< .ctor> b__1(对象未使用)
       在System.Windows.Threading.ExceptionWrapper.InternalRealCall(委托的回调,对象的args,的Int32 numArgs)
       在MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(对象源,委托方法,对象的args,的Int32 numArgs,代表catchHandler)
       在System.Windows.Threading.DispatcherOperation.InvokeImpl()
       在System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(对象状态)
       在System.Threading.ExecutionContext.RunInternal(ExecutionContext中的ExecutionContext,ContextCallback回调,对象的状态,布尔preserveSyncCtx)
       在System.Threading.ExecutionContext.Run(ExecutionContext中的ExecutionContext,ContextCallback回调,对象的状态,布尔preserveSyncCtx)
       在System.Threading.ExecutionContext.Run(ExecutionContext中的ExecutionContext,ContextCallback回调,对象的状态)
       在System.Windows.Threading.DispatcherOperation.Invoke()
       在System.Windows.Threading.Dispatcher.ProcessQueue()
       在System.Windows.Threading.Dispatcher.WndProcHook(IntPtr的HWND,味精的Int32,IntPtr的wParam中,IntPtr的lParam的,布尔和放大器;处理)
       在MS.Win32.HwndWrapper.WndProc(IntPtr的HWND,味精的Int32,IntPtr的wParam中,IntPtr的lParam的,布尔和放大器;处理)
       在MS.Win32.HwndSubclass.DispatcherCallbackOperation(对象o)
       在System.Windows.Threading.ExceptionWrapper.InternalRealCall(委托的回调,对象的args,的Int32 numArgs)
       在MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(对象源,委托方法,对象的args,的Int32 numArgs,代表catchHandler)
       在System.Windows.Threading.Dispatcher.LegacyInvokeImpl(的DispatcherPriority优先,时间跨度超时,代表法,对象指定参数时,的Int32 numArgs)
       在MS.Win32.HwndSubclass.SubclassWndProc(IntPtr的HWND,味精的Int32,IntPtr的wParam中,IntPtr的lParam的)
       在MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG和放大器; MSG)
       在System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame帧)
       在System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame帧)
       在System.Windows.Threading.Dispatcher.Run()
       在System.Windows.Application.RunDispatcher(对象忽略)
       在System.Windows.Application.RunInternal(窗窗)
       在System.Windows.Application.Run(窗窗)
       在System.Windows.Application.Run()
       在premierAutoDataExtractor.App.Main()
  的InnerException信息:System.IO.FileNotFoundException
       HResult的= -2147024894
       消息=无法加载文件或程序集presentationFramework.Aero2公钥= 31bf3856ad364e35或它的某一个依赖。该系统找不到指定的文件。
       来源= mscorlib程序
       文件名= presentationFramework.Aero2公钥= 31bf3856ad364e35
       FusionLog =警告:程序集绑定日志记录被关闭。
要启用程序集绑定失败日志记录,注册表值[HKLM \软件\微软\融合!EnableLog](DWORD)设置为1。
注意:有一些与程序集绑定失败日志记录关联的性能损失。
要关闭此功能,删除注册表值[HKLM \软件\微软\融合!EnableLog。

       堆栈跟踪:
            在System.Reflection.RuntimeAssembly._nLoad(的AssemblyName文件名,字符串codeBase的,证据assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark和放大器; stackMark,IntPtr的pPrivHostBinder,布尔throwOnFileNotFound,布尔forIntrospection,布尔SUP pressSecurityChecks)
            在System.Reflection.RuntimeAssembly.nLoad(的AssemblyName文件名,字符串codeBase的,证据assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark和放大器; stackMark,IntPtr的pPrivHostBinder,布尔throwOnFileNotFound,布尔forIntrospection,布尔SUP pressSecurityChecks)
            在System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(的AssemblyName assemblyRef,证据assemblySecurity,RuntimeAssembly reqAssembly,StackCrawlMark和放大器; stackMark,IntPtr的pPrivHostBinder,布尔throwOnFileNotFound,布尔forIntrospection,布尔SUP pressSecurityChecks)
            在System.Reflection.Assembly.Load(的AssemblyName assemblyRef)
            在System.Windows.Baml2006.Baml2006SchemaContext.ResolveAssembly(BamlAssembly bamlAssembly)
            在System.Windows.Baml2006.Baml2006SchemaContext.ResolveBamlTypeToType(BamlType bamlType)
            在System.Windows.Baml2006.Baml2006SchemaContext.ResolveBamlType(BamlType bamlType,Int16的TYPEID)
            在System.Windows.Baml2006.Baml2006SchemaContext.GetXamlType(Int16的TYPEID)
            在System.Windows.Baml2006.Baml2006Reader.Process_ElementStart()
            在System.Windows.Baml2006.Baml2006Reader.Process_OneBamlRecord()
            在System.Windows.Baml2006.Baml2006Reader.ReadObject(KeyRecord记录)
            在System.Windows.ResourceDictionary.CreateObject(KeyRecord键)
            在System.Windows.ResourceDictionary.OnGettingValue(对象的关键,对象和放大器;值,布尔和放大器; canCache)
            在System.Windows.ResourceDictionary.OnGettingValuePrivate(对象的关键,对象和放大器;值,布尔和放大器; canCache)
            在System.Windows.ResourceDictionary.GetValueWithoutLock(对象键,布尔和放大器; canCache)
            在System.Windows.ResourceDictionary.GetValue(对象键,布尔和放大器; canCache)
            在System.Windows.DeferredResourceReference.GetValue(BaseValueSourceInternal valueSource)
            在System.Windows.DeferredAp presourceReference.GetValue(BaseValueSourceInternal valueSource)
            在System.Windows.DependencyObject.GetEffectiveValue(EntryIndex entryIndex,DP的DependencyProperty,RequestFlags请求)
            在System.Windows.DependencyObject.GetValueEntry(EntryIndex entryIndex,DP的DependencyProperty,PropertyMetadata元,RequestFlags请求)
            在System.Windows.DependencyObject.GetValue(DependencyProperty的DP)
            在System.Windows.Controls.DataGridHelper.GetCoercedTransferPropertyValue(DependencyObject的baseObject,对象baseValue,DependencyProperty的baseProperty,DependencyObject的parentObject,DependencyProperty的parentProperty,DependencyObject的grandParentObject,DependencyProperty的grandParentProperty)
            在System.Windows.Controls.DataGridColumn.OnCoerceHeaderStyle(DependencyObject的研发,对象baseValue)
            在System.Windows.DependencyObject.ProcessCoerceValue(DependencyProperty的DP,PropertyMetadata元,EntryIndex和放大器; entryIndex,的Int32和放大器; targetIndex,EffectiveValueEntry和放大器; newEntry,EffectiveValueEntry和放大器; oldEntry,对象和放大器;属性oldValue,对象baseValue,对象controlValue,CoerceValueCallback coerceValueCallback,布尔coerceWithDeferredReference,布尔coerceWithCurrentValue,布尔skipBaseValueChecks)
            在System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex,DP的DependencyProperty,PropertyMetadata元,EffectiveValueEntry oldEntry,EffectiveValueEntry和放大器; newEntry,布尔coerceWithDeferredReference,布尔coerceWithCurrentValue,OperationType operationType)
            在System.Windows.DependencyObject.CoerceValue(DependencyProperty的DP)
            在System.Windows.Controls.DataGridHelper.TransferProperty(DependencyObject的研发,DependencyProperty的P)
            在System.Windows.Controls.DataGridColumn.SyncProperties()
            在System.Windows.Controls.DataGrid.UpdateColumnSizeConstraints(IList的列表)
            在System.Windows.Controls.DataGrid.OnColumnsChanged(对象发件人,NotifyCollectionChangedEventArgs E)
            在System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs E)
            在System.Windows.Controls.DataGridColumnCollection.OnCollectionChanged(NotifyCollectionChangedEventArgs E)
            在System.Collections.ObjectModel.ObservableCollection`1.InsertItem(的Int32指数,T项)
            在System.Windows.Controls.DataGridColumnCollection.InsertItem(的Int32索引的DataGridColumn项)
            在System.Collections.ObjectModel.Collection`1.Add(T项)
            在System.Collections.ObjectModel.Collection`1.System.Collections.IList.Add(对象的值)
            在System.Xaml.Schema.XamlTypeInvoker.AddToCollection(Object实例,对象项)
            在MS.Internal.Xaml.Runtime.ClrObjectRuntime.Add(对象集合,XamlType collectionType,对象的值,XamlType valueXamlType)
       的InnerException:
 

解决方案

我遇到了类似的问题。背景:开发基于Windows 8 WPF应用程序使用的Visual Studio 2012,混合2012年,.NET 4.5。 App.xaml中引用的presentationFramework.Aero2为主题。使用ClickOnce分发应用程序。

苹果拒绝 旁加载 ,并不只是因为Epic Games

在Windows 8中,没有任何问题。在Windows XP / Vista / 7系统,应用程序会出错一部分进入执行(第一子页面的引用Aero2上)与上述无法加载程序集异常记录。

尝试修复:标志Aero2复制本地项目(没有帮助),试图在的ClickOnce安装程序(没有出现在可用的组件列表中),在C复制到WPF文件夹目标Windows7的计算机上,包括:\ WINDOWS \ microsoft.net \框架\ V4.XX \ WPF(没有帮助)。

解决方法:

替换从presentationFramework.Aero2至presentationFramework.Aero项目引用,然后修改XAML引用匹配。可以很容易地推到非Windows 8机器并运行它。发展工作正常。唯一不同的发现是进度条的默认外观有光泽/ 3D。

I recently finished my first WPF application I have been developing using Windows 8. It has worked fine on my machine. A friend of mine ran it in visual studio on his Windows 8 machine as well, and that worked. I install the program using click once on my machine, and it installs fine and runs.

I installed Windows 7 on virtual box and attempted to install it using the click once. It fetched .NET 4.5 and SQL Server Compact, the install process seemed flawless. When Windows 7 tried to run the application, nothing useful happened. I installed Visual Studio in virtualbox and was able to get this stack trace.

I looked up the PresentationFramework.Aero2 on Google and came across 3 SO questions and one MSDN question. The MSDN question gave me a hint of what I think it might be. If I go to C:\Windows\Microsoft.NET\Framework\4.0\WPF there is no PresentationFramework.Aero2.dll file, whereas on Windows 8 there is... so I copied and pasted it into the windows 7 equivalent place hoping to achieve something, but nothing came of it.

Here is the Stack Trace:

System.Windows.Markup.XamlParseException was unhandled
  HResult=-2146233087
  Message='Add value to collection of type 'System.Collections.ObjectModel.ObservableCollection(System.Windows.Controls.DataGridColumn)' threw an exception.' Line number '35' and line position '71'.
  Source=PresentationFramework
  LineNumber=35
  LinePosition=71
  StackTrace:
       at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
       at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
       at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
       at System.Windows.Application.LoadBamlStreamWithSyncInfo(Stream stream, ParserContext pc)
       at System.Windows.Application.LoadComponent(Uri resourceLocator, Boolean bSkipJournaledProperties)
       at System.Windows.Application.DoStartup()
       at System.Windows.Application.<.ctor>b__1(Object unused)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.DispatcherOperation.InvokeImpl()
       at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Windows.Threading.DispatcherOperation.Invoke()
       at System.Windows.Threading.Dispatcher.ProcessQueue()
       at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
       at System.Windows.Threading.Dispatcher.Run()
       at System.Windows.Application.RunDispatcher(Object ignore)
       at System.Windows.Application.RunInternal(Window window)
       at System.Windows.Application.Run(Window window)
       at System.Windows.Application.Run()
       at PremierAutoDataExtractor.App.Main()
  InnerException: System.IO.FileNotFoundException
       HResult=-2147024894
       Message=Could not load file or assembly 'PresentationFramework.Aero2, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
       Source=mscorlib
       FileName=PresentationFramework.Aero2, PublicKeyToken=31bf3856ad364e35
       FusionLog=WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

       StackTrace:
            at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
            at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
            at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
            at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
            at System.Windows.Baml2006.Baml2006SchemaContext.ResolveAssembly(BamlAssembly bamlAssembly)
            at System.Windows.Baml2006.Baml2006SchemaContext.ResolveBamlTypeToType(BamlType bamlType)
            at System.Windows.Baml2006.Baml2006SchemaContext.ResolveBamlType(BamlType bamlType, Int16 typeId)
            at System.Windows.Baml2006.Baml2006SchemaContext.GetXamlType(Int16 typeId)
            at System.Windows.Baml2006.Baml2006Reader.Process_ElementStart()
            at System.Windows.Baml2006.Baml2006Reader.Process_OneBamlRecord()
            at System.Windows.Baml2006.Baml2006Reader.ReadObject(KeyRecord record)
            at System.Windows.ResourceDictionary.CreateObject(KeyRecord key)
            at System.Windows.ResourceDictionary.OnGettingValue(Object key, Object& value, Boolean& canCache)
            at System.Windows.ResourceDictionary.OnGettingValuePrivate(Object key, Object& value, Boolean& canCache)
            at System.Windows.ResourceDictionary.GetValueWithoutLock(Object key, Boolean& canCache)
            at System.Windows.ResourceDictionary.GetValue(Object key, Boolean& canCache)
            at System.Windows.DeferredResourceReference.GetValue(BaseValueSourceInternal valueSource)
            at System.Windows.DeferredAppResourceReference.GetValue(BaseValueSourceInternal valueSource)
            at System.Windows.DependencyObject.GetEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, RequestFlags requests)
            at System.Windows.DependencyObject.GetValueEntry(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, RequestFlags requests)
            at System.Windows.DependencyObject.GetValue(DependencyProperty dp)
            at System.Windows.Controls.DataGridHelper.GetCoercedTransferPropertyValue(DependencyObject baseObject, Object baseValue, DependencyProperty baseProperty, DependencyObject parentObject, DependencyProperty parentProperty, DependencyObject grandParentObject, DependencyProperty grandParentProperty)
            at System.Windows.Controls.DataGridColumn.OnCoerceHeaderStyle(DependencyObject d, Object baseValue)
            at System.Windows.DependencyObject.ProcessCoerceValue(DependencyProperty dp, PropertyMetadata metadata, EntryIndex& entryIndex, Int32& targetIndex, EffectiveValueEntry& newEntry, EffectiveValueEntry& oldEntry, Object& oldValue, Object baseValue, Object controlValue, CoerceValueCallback coerceValueCallback, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, Boolean skipBaseValueChecks)
            at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
            at System.Windows.DependencyObject.CoerceValue(DependencyProperty dp)
            at System.Windows.Controls.DataGridHelper.TransferProperty(DependencyObject d, DependencyProperty p)
            at System.Windows.Controls.DataGridColumn.SyncProperties()
            at System.Windows.Controls.DataGrid.UpdateColumnSizeConstraints(IList list)
            at System.Windows.Controls.DataGrid.OnColumnsChanged(Object sender, NotifyCollectionChangedEventArgs e)
            at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
            at System.Windows.Controls.DataGridColumnCollection.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
            at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
            at System.Windows.Controls.DataGridColumnCollection.InsertItem(Int32 index, DataGridColumn item)
            at System.Collections.ObjectModel.Collection`1.Add(T item)
            at System.Collections.ObjectModel.Collection`1.System.Collections.IList.Add(Object value)
            at System.Xaml.Schema.XamlTypeInvoker.AddToCollection(Object instance, Object item)
            at MS.Internal.Xaml.Runtime.ClrObjectRuntime.Add(Object collection, XamlType collectionType, Object value, XamlType valueXamlType)
       InnerException: 

解决方案

I ran into a similar issue. Context: Developing WPF app on Windows 8 using Visual Studio 2012, Blend for 2012, .NET 4.5. APP.XAML referenced the PresentationFramework.Aero2 for themes. Distributing App using ClickOnce.

On Windows 8, no problems. On Windows XP/Vista/7, application would crash on part way into execution (on the first sub-page that referenced Aero2) with the aforementioned "Could not load assembly" exception recorded.

Attempted fixes: Flag Aero2 to copy local in project (did not help), attempted to include in ClickOnce Installer (did not appear in list of available assemblies), copied to WPF folder on target Windows7 machine under c:\windows\microsoft.net\framework\v4.xx\wpf (did not help).

Resolution:

Replace reference in project from PresentationFramework.Aero2 to PresentationFramework.Aero and then modified XAML references to match. Could readily push to non-Windows 8 machines and have it run. Development works properly. Only difference found was the default appearance of progress bars was glossy / 3d.