none
Ribbon Designer in Class Library Project - .Net 4.0 Visual Studio 2013 RRS feed

  • Question

  • I want to share a ribbon between several c# office projects using visual studio 2013 and .NET 4.0.

    I followed the instructions here http://blogs.msdn.com/b/vsto/archive/2010/06/23/sharing-a-ribbon-customization-between-office-projects-in-visual-studio-2010-mclean-schofield.aspx

    It runs like a charm, but...

    I am not able anymore to open the "ribbon designer" and the stacktrace is as follow:

    The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))     

    at EnvDTE.Properties.Item(Object index)
    at Microsoft.VisualStudio.Tools.Office.Ribbon.Helpers.GetTargetOfficeVersion(IDesignerHost host)
    at Microsoft.VisualStudio.Tools.Office.Ribbon.View.RibbonView.InitializeTheme()
    at Microsoft.VisualStudio.Tools.Office.Ribbon.View.RibbonView.set_Site(ISite value)
    at System.ComponentModel.Container.Add(IComponent component, String name)
    at System.ComponentModel.Design.DesignerHost.PerformAdd(IComponent component, String name)
    at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type componentType, String name)
    at System.ComponentModel.Design.Serialization.DesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
    at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
    at Microsoft.VisualStudio.Tools.Office.Serialization.TypeResolutionModifications.VSTDesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
    at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
    at Microsoft.VisualStudio.Tools.Office.Ribbon.Serialization.RibbonTypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
    at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
    at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
    at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host)

    Could someone help?


    Tuesday, October 7, 2014 11:03 AM

Answers

  • Hi Enguerran,

    Based on the description, you are sharing an ribbon customization between Office projects by following the blog.

    As the statment in this blog, the upshot is that you can no longer open the Ribbon designer outside of Office projects.

    So I think the issue we can't use Ribbon designer in the library porject is expected. If you want to Visual Studio support to use Ribbon design outsice the Office project, I suggest that you submit the feedback from link below:
    How to: Send Feedback About Visual Studio

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, October 15, 2014 9:53 AM
    Moderator

All replies

  • Hello Enguerran,

    The Ribbon designer doesn't support all features.

    I'd suggest using the raw XML markup for implementing this. You can read more about the Ribbon UI in the following articles in MSDN:

    Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)

    Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)

    Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)Pay special attention to the How do I create two add-ins that add items to the same group or tab? section which states the following:

    The idQ property of controls exists to enable multiple add-ins to share containers, such as custom tabs and groups.

    In the following VBA example, two Excel add-ins share the same "Contoso" group on the add-ins tab; each adds one button to it. The key is specifying the same unique namespace in the <customUI> tag. Then, controls can reference this namespace by using idQ.

    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" 
      xmlns:x="myNameSpace" >
      <ribbon>
        <tabs>
          <tab idMso="TabAddIns">
            <group idQ="x:Contoso" label="Contoso">
              <button id="C1" label="Contoso Button 1" size="large" 
                imageMso="FileSave" onAction="c_action1" />
            </group>
          </tab>
        </tabs>
      </ribbon>
    </customUI>
    
    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" 
      xmlns:x="myNameSpace" >
      <ribbon>
        <tabs>
          <tab idMso="TabAddIns">
            <group idQ="x:Contoso" label="Contoso">
              <button id="C2" label="Contoso Button 2" size="large" 
                imageMso="FileSave" onAction="c_action2" />
            </group>
          </tab>
        </tabs>
      </ribbon>
    </customUI>
    

    If you use a COM add-in to customize the Fluent UI, the namespace name must be the ProgID of the COM add-in, but the behavior is otherwise the same. When you use a shared add-in, the ProgID is AddInName.Connect.

    Tuesday, October 7, 2014 2:23 PM
  • Hi Enguerran,

    Based on the description, you are sharing an ribbon customization between Office projects by following the blog.

    As the statment in this blog, the upshot is that you can no longer open the Ribbon designer outside of Office projects.

    So I think the issue we can't use Ribbon designer in the library porject is expected. If you want to Visual Studio support to use Ribbon design outsice the Office project, I suggest that you submit the feedback from link below:
    How to: Send Feedback About Visual Studio

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, October 15, 2014 9:53 AM
    Moderator