Windows Ribbon for WinForms in Visual Studio 2013

The Windows Ribbon project is still working in Visual Studio 2013. Now I will show you the steps I did to get it working.

Download and install Windows 8.1 SDK

Windows 7 SDK is also enough.

Bild 156

Download the Latest Ribbon Sources

http://windowsribbon.codeplex.com/SourceControl/latest

Bild 152

Get the RibbonGenerator compiling

The download is below. You do not need this.

Bild 153

Microsoft.VisualStudio.Shell not found?

Bild 154 Bild 155

 Download Visual Studio 2013 SDK

Bild 157

Bild 158

Bild 159

Switch the target of the RibbonGenerator

Bild 160

Bild 161

Now it should compile.

Download the Ribbon Generator for Visual Studio 2013

Note that it this one will only work for VS 2013. Download contains RibbonGenerator binaries and source.
http://sdrv.ms/1ewICJN

Register the Ribbon Generator (Custom Tool)

– Create a .reg file and import it. This one will only work with VS 2013 and a x64 Windows.

Windows Registry Editor Version 5.00</pre>
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0\CLSID\{B64582D9-A489-42F4-BA55-BB6039D82916}]
@="RibbonGenerator"
"InprocServer32"="C:\\WINDOWS\\system32\\mscoree.dll"
"Class"="RibbonGenerator.CustomTool"
"Assembly"="RibbonGenerator, Version=1.0.1.0, Culture=neutral, PublicKeyToken=3cf107c5d7e68b1c"
"ThreadingModel"="Both"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0\Generators\{164B10B9-B200-11D0-8C61-00A0C91E29D5}\RibbonGenerator]
@="Ribbon Generator"
"CLSID"="{B64582D9-A489-42F4-BA55-BB6039D82916}"
"GeneratesDesignTimeSource"=dword:00000001

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0\Generators\{E6FDF8B0-F3D1-11D4-8576-0002A516ECE8}\RibbonGenerator]
@="Ribbon Generator"
"CLSID"="{B64582D9-A489-42F4-BA55-BB6039D82916}"
"GeneratesDesignTimeSource"=dword:00000001

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0\Generators\{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}\RibbonGenerator]
@="Ribbon Generator"
"CLSID"="{B64582D9-A489-42F4-BA55-BB6039D82916}"
"GeneratesDesignTimeSource"=dword:00000001
<pre>

– Open Cmd as Administrator

– Use the correct version of gacutil.

“C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\gacutil.exe” -i “C:\…\RibbonGenerator.dll”

Check RibbonGenerator Registration

Check that Ribbon Generator is working correctly.

– Open the Ribbon-cs.sln solution

– Right-click on RibbonMarkup.xml and click Run Custom Tool

Bild 167

The following screenshot means, you have done a mistake in the previous steps.

Bild 166

Update the template.bat

No error occurred, but still not work? Check that all the tools are on your hard disc. Check all pathes to be  correct …

C:\Users\<user>\AppData\Local\RibbonGenerator\Template.bat”


"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\UICC.exe" "{XmlFilename}" "{BmlFilename}" /res:"{RcFilename}"
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\rc.exe" /v "{RcFilename}"
cmd /c "("%VS120COMNTOOLS%..\..\VC\bin\vcvars32.bat") && ("%VS120COMNTOOLS%..\..\VC\bin\link.exe" /VERBOSE /NOENTRY /DLL /OUT:"{DllFilename}" "{ResFilename}")"

Other Ribbon Posts

Quickstart Tutorial: Windows Ribbon for WinForms
RibbonGenerator Details: Windows Ribbon for WinForms
RibbonGenerator for Visual Studio 2010 Express Editions: Windows Ribbon for WinForms

Advertisements

26 thoughts on “Windows Ribbon for WinForms in Visual Studio 2013

  1. […] Quickstart Tutorial: Windows Ribbon for WinForms RibbonGenerator for Visual Studio 2010 Express Editions: Windows Ribbon for WinForms RibbonGenerator Details: Windows Ribbon for WinForms Windows Ribbon for WinForms in Visual Studio 2013 […]

  2. […] RibbonGenerator for Visual Studio 2010 Express Editions: Windows Ribbon for WinForms RibbonGenerator Details: Windows Ribbon for WinForms Windows Ribbon for WinForms in Visual Studio 2013 […]

  3. Mr. Batman says:

    I was at your blog yesterday looking at old posts to do just this. I came back today and BAM! Here it is! Great job!!

  4. juan says:

    I’ve followed the steps but I cannot make it work. I get the Cannot find custom tool error. I’m on Windows 8.1 x64 and VS Ultimate 2013. I guess something is missing, could you help me in any way?? Thank you!

    • Bernhard says:

      You can use the .reg file from the post here. You also need to use the X86 version of gacutil because Visual Studio is X86
      “C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\gacutil.exe” -i “C:\…\RibbonGenerator.dll”

      Did you?

      • juan says:

        Yes I did! I also check it with regedit. On the other hand I check it with gacutil.exe -l to be sure. I don’t know what else to do because I’ve followed all the steps in your post. Any ideas?? Thank you very much!

  5. Alan Compton says:

    I too, struggled for some time to get the tool to be recognised by Visual Studio 2013 (on Windows 7).

    The supplied RegisterCustomTool_VS2013_x64.reg file is correct.

    I found that I had copy all the keys that refer to:
    [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio
    \12.0\

    And make a copy as
    [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0_Config

    Once these keys were registered, it worked.

    • juan says:

      Now there is NO error but nothing happens. I’ve checked the paths and all the tools are on my hard disk. I don’t know what else todo! Any suggestions?? Thank you!

  6. Alan Compton says:

    I had to edit the template.bat to get the paths right. I tried running it manually, checking the SET variables as well. This showed up problems in the templates.bat

    When the tool is run, there is a detailed output log is in:
    C:\Users\\AppData\Local\RibbonGenerator\RibbonGenerator.log

  7. Mattia says:

    Hi, I get the Cannot find custom tool error.
    – I install windows 8.1 sdk
    – I installed visual studio 2013 professional
    – i installed this package http://sdrv.ms/1ewICJN
    – I run the .reg included for visual studio 2013
    – I copied the contents of the zip file to c:\Ribbongenerator
    – I run this command “C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\gacutil.exe” -i “C:\…\RibbonGenerator.dll”
    – i open Ribbon-cs.sln and I performed the required conversion from .net 3.5 to .net 4.5

    my config: win 8.1 x64, visual studio 2013 pro update 3

    thanks!

  8. tajbender says:

    Thanks for this… For me, it was very tricky, cause after some tries, I couldn’t get the Generator tu run… Finally, I just rebooted, gave it another try and suddenly it worked… Very strange indeed.

    Using Win7 64 bit, Visual Studio 2013 Community.

    A installer-driven Installation would be very, very nice for this!

  9. Dave says:

    After several hours, I still can’t get Visual Studio 2013 to recognize the Custom Tool. I’ve confirmed that the RibbonGenerator file is in the GAC. I have the registry entries in-place. I’ve tried rebooting. No change. Running Windows 7 Enterprise, 64-bit. Visual Studio 2013 Pro. I hate to have to give up now, after putting all morning in trying to make this work.

    • Dave says:

      Bah! Finally got it. I had not installed the Visual studio sdk. I had assumed that, since I’ve been using Vs almost daily for over a year and a half, I had already had it installed. But I just got the test for the Custom Tool linkage to run correctly.

  10. Dave says:

    Does this ribbon NOT work with vector images then? I see documentation here that suggests “no”: http://blogs.microsoft.co.il/arik/2009/09/23/windows-ribbon-for-winforms-part-4-application-menu-with-buttons/

  11. Jianchuan Xue says:

    At last,I got it works with Win10 and vs2013
    setps
    1,build RibbonGenerator.DLL
    2,reg

    [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0\CLSID\{B64582D9-A489-42F4-BA55-BB6039D82916}]
    @=”RibbonGenerator”
    “InprocServer32″=”C:\\WINDOWS\\system32\\mscoree.dll”
    “Class”=”RibbonGenerator.CustomTool”
    “Assembly”=”RibbonGenerator, Version=1.0.1.0, Culture=neutral, PublicKeyToken=3cf107c5d7e68b1c”
    “ThreadingModel”=”Both”

    [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0\Generators\{164B10B9-B200-11D0-8C61-00A0C91E29D5}\RibbonGenerator]
    @=”Ribbon Generator”
    “CLSID”=”{B64582D9-A489-42F4-BA55-BB6039D82916}”
    “GeneratesDesignTimeSource”=dword:00000001

    [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0\Generators\{E6FDF8B0-F3D1-11D4-8576-0002A516ECE8}\RibbonGenerator]
    @=”Ribbon Generator”
    “CLSID”=”{B64582D9-A489-42F4-BA55-BB6039D82916}”
    “GeneratesDesignTimeSource”=dword:00000001

    [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0\Generators\{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}\RibbonGenerator]
    @=”Ribbon Generator”
    “CLSID”=”{B64582D9-A489-42F4-BA55-BB6039D82916}”
    “GeneratesDesignTimeSource”=dword:00000001

    Windows Registry Editor Version 5.00
    [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0_Config\CLSID\{B64582D9-A489-42F4-BA55-BB6039D82916}]
    @=”RibbonGenerator”
    “InprocServer32″=”C:\\WINDOWS\\system32\\mscoree.dll”
    “Class”=”RibbonGenerator.CustomTool”
    “Assembly”=”RibbonGenerator, Version=1.0.1.0, Culture=neutral, PublicKeyToken=3cf107c5d7e68b1c”
    “ThreadingModel”=”Both”

    [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0_Config\Generators\{164B10B9-B200-11D0-8C61-00A0C91E29D5}\RibbonGenerator]
    @=”Ribbon Generator”
    “CLSID”=”{B64582D9-A489-42F4-BA55-BB6039D82916}”
    “GeneratesDesignTimeSource”=dword:00000001

    [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0_Config\Generators\{E6FDF8B0-F3D1-11D4-8576-0002A516ECE8}\RibbonGenerator]
    @=”Ribbon Generator”
    “CLSID”=”{B64582D9-A489-42F4-BA55-BB6039D82916}”
    “GeneratesDesignTimeSource”=dword:00000001

    [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0_Config\Generators\{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}\RibbonGenerator]
    @=”Ribbon Generator”
    “CLSID”=”{B64582D9-A489-42F4-BA55-BB6039D82916}”
    “GeneratesDesignTimeSource”=dword:00000001

    3,gac

    “C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\gacutil.exe” -i “C:\…\RibbonGenerator.dll”

    4,put template.dat

    C:\Users\\AppData\Local\RibbonGenerator\Template.bat
    if you logined with administrator,so the path is :
    C:\Users\administrator\AppData\Local\RibbonGenerator\Template.bat

    5,check the template.bat file’s content

    “C:\Program Files (x86)\Windows Kits\8.1\bin\x86\UICC.exe” “{XmlFilename}” “{BmlFilename}” /res:”{RcFilename}”
    “C:\Program Files (x86)\Windows Kits\8.1\bin\x86\rc.exe” /v “{RcFilename}”
    cmd /c “(“%VS120COMNTOOLS%..\..\VC\bin\vcvars32.bat”) && (“%VS120COMNTOOLS%..\..\VC\bin\link.exe” /VERBOSE /NOENTRY /DLL /OUT:”{DllFilename}” “{ResFilename}”)”

  12. Frederic V.O. says:

    The OneDrive download is broken.

  13. Frederic V.O. says:

    I followed all steps and it DOESN’T WORK for VS 2013.

    1>—— Build started: Project: RibbonGenerator, Configuration: Debug Any CPU ——
    1>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1697,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly “Microsoft.VisualStudio.Shell, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL”. Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
    1>C:\Users\Kevin\Documents\Visual Studio 2013\SDKs\C#\ribbon70298\RibbonGenerator\RibbonGenerator\VsMultipleFileGenerator.cs(175,21,175,36): error CS0246: The type or namespace name ‘ServiceProvider’ could not be found (are you missing a using directive or an assembly reference?)
    1>C:\Users\Kevin\Documents\Visual Studio 2013\SDKs\C#\ribbon70298\RibbonGenerator\RibbonGenerator\VsMultipleFileGenerator.cs(175,46,175,61): error CS0246: The type or namespace name ‘ServiceProvider’ could not be found (are you missing a using directive or an assembly reference?)
    1>C:\Users\Kevin\Documents\Visual Studio 2013\SDKs\C#\ribbon70298\RibbonGenerator\RibbonGenerator\VsMultipleFileGenerator.cs(269,20,269,31): error CS0103: The name ‘VSConstants’ does not exist in the current context
    1>C:\Users\Kevin\Documents\Visual Studio 2013\SDKs\C#\ribbon70298\RibbonGenerator\RibbonGenerator\CustomTool.cs(36,20,36,31): error CS0103: The name ‘VSConstants’ does not exist in the current context
    1>C:\Users\Kevin\Documents\Visual Studio 2013\SDKs\C#\ribbon70298\RibbonGenerator\RibbonGenerator\VsHelper.cs(35,52,35,67): error CS0246: The type or namespace name ‘ServiceProvider’ could not be found (are you missing a using directive or an assembly reference?)
    1>C:\Users\Kevin\Documents\Visual Studio 2013\SDKs\C#\ribbon70298\RibbonGenerator\RibbonGenerator\VsHelper.cs(35,144,35,160): error CS0103: The name ‘VsShellUtilities’ does not exist in the current context
    2>—— Build started: Project: RibbonGenerator.Console, Configuration: Debug x86 ——
    3>—— Build started: Project: RibbonGenerator.Test, Configuration: Debug Any CPU ——
    2>CSC : error CS0006: Metadata file ‘C:\Users\Kevin\Documents\Visual Studio 2013\SDKs\C#\ribbon70298\RibbonGenerator\RibbonGenerator\bin\Debug\RibbonGenerator.dll’ could not be found
    3>CSC : error CS0006: Metadata file ‘C:\Users\Kevin\Documents\Visual Studio 2013\SDKs\C#\ribbon70298\RibbonGenerator\RibbonGenerator\bin\Debug\RibbonGenerator.dll’ could not be found
    ========== Build: 0 succeeded, 3 failed, 0 up-to-date, 0 skipped ==========

  14. Frederic V.O. says:

    OK I finally compiled it. I had to manually remove the reference to shell and add it by browsing to where the SDK set it up.

  15. Conservative Atheist says:

    Do you ever publish new comments? I’m so desperate to make this work. At about EVERY small step I ran into trouble. Eve if you can’t help maybe a comment reader can.

  16. Conservative Atheist says:

    OK I finally made it work.
    Apparently VS 2013 CE does not allow to add it to the designer toolbox. With manual code I was able to add the ribbon. (first add a reference to Ribbon.dll to the project)

    this._ribbon.Location = new System.Drawing.Point(0, 0);
    this._ribbon.Minimized = false;
    this._ribbon.Name = “_ribbon”;
    this._ribbon.ResourceName = “OwnSampleTest.RibbonMarkup.ribbon”; //Namespacename.RibbonMarkup.ribbon
    this._ribbon.ShortcutTableResourceName = null;
    this._ribbon.Size = new System.Drawing.Size(407, 100);
    this._ribbon.TabIndex = 2;
    this.Controls.Add(this._ribbon); //Since the designer is not working for this, do it manually.

    I also had to figure out that despite what the log file apparently shows, it is not APPLICATION_RIBBON as resource name but NameSpace.RibbonMarkup.ribbon

    Another note: the ribbon generator never gets invoked automatically at compile time but I can launch it manually be right clicking the xml file and “Run custom tool”.

    • Bernhard says:

      Hi, great that you was able to solve it. The ribbon generator is a VS Custom Tool. They invoked automatically only, if the corresponding file changes and not during build (it is not necessary).

  17. Daniel says:

    Hi, One important thing if someone uses a vb-project: The property “ResourceName” of the control needs to be adjusted if the project has a RootNameSpace – i.e. instead: “RibbonMarkup.ribbon” it has to be: “MyRootNS.RibbonMarkup.ribbon”.

  18. I followed all the above steps and got it working. when I made a slight change to .Resx file and build the project it generates a new .Ribbon file also. However, when I launch the application the the title on the ribbon comes like this.

    {Resource:cmdButtonOne_LabelTitle}. As it is defined in .xml file. Please assist on this. Thanks. How do I get the actual title display on the ribbon?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: