Ribbon dependency error

Mar 18, 2011 at 10:10 AM

Hi,

I'm having this strange issue on a specific computer running .NET 4.0 Framework. On another computer the error below does not occur, and I can gurantee that it's the same source code (TFS version controlled). I already tried reparing the .NET Framework 4.0 installation.

Heres the exception details. The core issue seems to be the System.IO.FileNotFoundException regarding the Microsoft.Windows.Shell assembly. Could this be my Windows 7 installation? It's not different that the other computer, but something might have broken it. Do you have any suggestions on how to fix this issue?

Thank you very much!

System.Windows.Markup.XamlParseException occurred
  Message='Initialization of 'Microsoft.Windows.Controls.Ribbon.RibbonSplitButton' threw an exception.' Line number '37' and line position '22'.
  Source=PresentationFramework
  LineNumber=37
  LinePosition=22
  StackTrace:
       at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
       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.LoadComponent(Object component, Uri resourceLocator)
       at Ams.RibbonModule.Views.OrderRibbonView.InitializeComponent() in c:\Users\thj\Workspace\Presentation.Ams.RibbonModule\Views\OrderRibbonView.xaml:line 1
       at Ams.RibbonModule.Views.OrderRibbonView..ctor() in C:\Users\thj\Workspace\Presentation.Ams.RibbonModule\Views\OrderRibbonView.xaml.cs:line 26
  InnerException: System.IO.FileNotFoundException
       Message=Could not load file or assembly 'Microsoft.Windows.Shell, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
       Source=mscorlib
       FileName=Microsoft.Windows.Shell, PublicKeyToken=31bf3856ad364e35
       FusionLog==== Pre-bind state information ===
LOG: User = STUG\thj
LOG: DisplayName = Microsoft.Windows.Shell, PublicKeyToken=31bf3856ad364e35
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: Microsoft.Windows.Shell, PublicKeyToken=31bf3856ad364e35 | Domain ID: 1
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Users/thj/Workspace/Presentation.Ams/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\thj\Workspace\Presentation.Ams\bin\Debug\Ams.vshost.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Users/thj/Workspace/Presentation.Ams/bin/Debug/Microsoft.Windows.Shell.DLL.
LOG: Attempting download of new URL file:///C:/Users/thj/Workspace/Presentation.Ams/bin/Debug/Microsoft.Windows.Shell/Microsoft.Windows.Shell.DLL.
LOG: Attempting download of new URL file:///C:/Users/thj/Workspace/Presentation.Ams/bin/Debug/Microsoft.Windows.Shell.EXE.
LOG: Attempting download of new URL file:///C:/Users/thj/Workspace/Presentation.Ams/bin/Debug/Microsoft.Windows.Shell/Microsoft.Windows.Shell.EXE.

       StackTrace:
            at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
            at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
            at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, 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.Baml2006SchemaContext.GetPropertyDeclaringType(Int16 propertyId)
            at System.Windows.Baml2006.Baml2006Reader.GetStaticExtensionValue(Int16 valueId, Type& memberType, Object& providedValue)
            at System.Windows.Baml2006.Baml2006Reader.Process_PropertyWithExtension()
            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.RealizeDeferContent(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.ResourceDictionary.FetchResource(Object resourceKey, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference, Boolean& canCache)
            at System.Windows.SystemResources.LookupResourceInDictionary(ResourceDictionary dictionary, Object key, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference, Boolean& canCache)
            at System.Windows.SystemResources.FindDictionaryResource(Object key, Type typeKey, ResourceKey resourceKey, Boolean isTraceEnabled, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference, Boolean& canCache)
            at System.Windows.SystemResources.FindResourceInternal(Object key, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference)
            at System.Windows.SystemResources.FindResourceInternal(Object key)
            at System.Windows.StyleHelper.GetThemeStyle(FrameworkElement fe, FrameworkContentElement fce)
            at System.Windows.FrameworkElement.UpdateThemeStyleProperty()
            at System.Windows.FrameworkElement.OnInitialized(EventArgs e)
            at System.Windows.Controls.Menu.OnInitialized(EventArgs e)
            at System.Windows.FrameworkElement.TryFireInitialized()
            at System.Windows.FrameworkElement.EndInit()
            at System.Windows.Controls.ItemsControl.EndInit()
            at MS.Internal.Xaml.Runtime.ClrObjectRuntime.InitializationGuard(XamlType xamlType, Object obj, Boolean begin)
       InnerException: 
Mar 18, 2011 at 10:22 AM

Right after posting the question, I solved the problem...

I still have a question though. What solved my problem was installing the "Microsoft Ribbon for WPF.msi" package found at MS Downloads. Before that all I had was the reference to the RibbonControlsLibrary. Now if I need to deploy this project to client computers, will they all have to install this package aswell, or can I include additional binaries in my project?

Apr 15, 2011 at 12:53 AM

Hi thj,

Were you able to find an answer to your question?

Apr 15, 2011 at 12:54 AM

Its kind of urgent for me, so if you did, please do reply back

Apr 15, 2011 at 7:45 AM

Hi abhiplex,

No, unfortunately not. Installing "Microsoft Ribbon for WPF.msi" solved my problem, but I'm still wondering why.

Jun 1, 2011 at 3:52 PM

I am having a similar issue and it is related to the version of Microsoft.Windows.Shell referenced by the project. The version of the RibbonControls.dll is trying to find is 3.5.41019.1 which is not what I have. There is a bug entered on Microsoft Connect for this: https://connect.microsoft.com/VisualStudio/feedback/details/642180/ribboncontrolslibrary-dll-for-net-4-0-should-use-the-frameworks-microsoft-windows-shell-instead-of-the-wpf-shell-integration-library 

May 11, 2012 at 1:08 PM
Edited May 11, 2012 at 1:12 PM

I also got the error, because i reinstalled my pc and didn't install the WPF Ribbon 4.0 from Microsoft. After install I needed to remove/add reference again, before my program would run.

Fixing the problem in 4.5 isn't going to solve my problem, so I'm adding the Microsoft.Windows.Shell Reference to my project.