2013-06-27 7 views
19

मैंने हाल ही में अपना पहला WPF एप्लिकेशन समाप्त किया है जिसे मैं विंडोज 8 का उपयोग कर विकसित कर रहा हूं। यह मेरी मशीन पर ठीक काम करता है। मेरा एक दोस्त इसे अपने विंडोज 8 मशीन पर भी विजुअल स्टूडियो में चला गया, और यह काम किया। मैं अपनी मशीन पर एक बार क्लिक करके प्रोग्राम इंस्टॉल करता हूं, और यह ठीक इंस्टॉल करता है और चलता है।विंडोज 7 असेंबली प्रेजेंटेशनफ्रेमवर्क.एरो 2 लोड क्यों नहीं कर सकता?

मैं आभासी बॉक्स पर विंडोज 7 स्थापित किया है और एक बार क्लिक का उपयोग कर इसे स्थापित करने के लिए प्रयास किया। यह .NET 4.5 और SQL सर्वर कॉम्पैक्ट लाया, इंस्टॉल प्रक्रिया दोषपूर्ण लग रहा था। जब विंडोज 7 ने एप्लिकेशन चलाने की कोशिश की, तो कुछ भी उपयोगी नहीं हुआ। मैंने वर्चुअलबॉक्स में विजुअल स्टूडियो स्थापित किया और यह स्टैक ट्रेस प्राप्त करने में सक्षम था।

मैं गूगल पर PresentationFramework.Aero2 देखा और 3 एसओ सवाल और एक MSDN सवाल बारे में जाना। एमएसडीएन प्रश्न ने मुझे एक संकेत दिया जो मुझे लगता है कि यह हो सकता है। अगर मैं सी के लिए जाना: \ Windows \ Microsoft.NET \ फ्रेमवर्क \ 4.0 \ WPF कोई PresentationFramework.Aero2.dll फ़ाइल है, Windows 8 पर है जबकि ... इसलिए मैं नकल की और विंडोज 7 बराबर जगह उम्मीद में चिपकाया कुछ हासिल करने के लिए, लेकिन इसके बारे में कुछ भी नहीं आया।

यहाँ स्टैक ट्रेस है:

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: 

उत्तर

28

मैं ने वही समस्या का सामना किया। संदर्भ: विजुअल स्टूडियो 2012 का उपयोग करके विंडोज 8 पर WPF ऐप का विकास, 2012 के लिए मिश्रण, .NET 4.5। APP.XAML ने थीम के लिए प्रेजेंटेशनफ्रेमवर्क.एरो 2 का संदर्भ दिया। ClickOnce का उपयोग कर ऐप वितरित करना।

Windows 8 कोई समस्या पर

। विंडोज एक्सपी/विस्टा/7 पर, आवेदन निष्पादन में भाग लेने के लिए भाग लिया जाएगा (पहले उप-पृष्ठ पर जो एरो 2 का संदर्भ दिया गया है) उपर्युक्त "असेंबली लोड नहीं किया जा सका" अपवाद के साथ।

का प्रयास किया गया फिक्स: झंडा Aero2 परियोजना में स्थानीय प्रतिलिपि बनाने के लिए (मदद नहीं की), ClickOnce इंस्टालर (उपलब्ध विधानसभाओं की सूची में प्रकट नहीं किया था), ग के तहत लक्ष्य Windows 7 मशीन पर WPF फ़ोल्डर में प्रतिलिपि में शामिल करने का प्रयास किया: \ windows \ microsoft.net \ framework \ v4.xx \ wpf (मदद नहीं की)।

समाधान:

PresentationFramework.Aero2 से PresentationFramework.Aero को परियोजना में संदर्भ की जगह और फिर संशोधित XAML संदर्भ मिलान करने के लिए। आसानी से गैर-विंडोज 8 मशीनों को धक्का दे सकता है और इसे चला सकता है। विकास ठीक से काम करता है। केवल अंतर पाया गया प्रगति सलाखों की डिफ़ॉल्ट उपस्थिति चमकदार/3 डी थी।

+0

ओह ठीक है यह भी पीछे की संगतता कहा जाता है? मुझे यह नहीं पता था! –

+1

@PaulVilevac, आपका मतलब क्या है "संदर्भ को प्रतिस्थापित करें ... प्रस्तुतिकरणफ्रेमवर्क.एरो"? आपने वास्तव में "प्रतिस्थापित" कैसे किया? क्या आपने इसका इस्तेमाल किया था। इसके बजाय या आपके समाधान ने गैर-विंडोज 8 डिवाइसों पर एरो 2 शैलियों को बरकरार रखा? –

+9

किसी और उलझन में हो रही के लिए, तुम सब करने की जरूरत है 'अपनी परियोजना से हटाने PresentationFramework.Aero2' संदर्भ और' PresentationFramework.Aero' संदर्भ जोड़ना है। इसके अलावा आपको अपने सभी नेमस्पेस आयातों में ** एरो 2 ** ** ** एरो ** को बदलना होगा; जैसे 'Xmlns: विषय =" clr-नाम स्थान: Microsoft.Windows.Themes; विधानसभा = PresentationFramework.Aero "'। इसके साथ चीजें मेरे लिए तय हो गईं। – dotNET

0

एक डेवलपर मशीन पर प्रस्तुति ढांचे विधानसभाओं के दो संस्करणों रहे हैं। विजुअल स्टूडियो "मेटाडाटा केवल" संस्करण का संदर्भ देता है। जब आप C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ WPF फ़ोल्डर की असेंबली को तैनात करते हैं तो इसे काम करना चाहिए (Problem with assembly PresentationFramework.Aero2 देखें)

संबंधित मुद्दे