Error when compiling ribbon.xml with VS2010

Jun 7, 2011 at 1:50 PM
Edited Jun 7, 2011 at 1:52 PM

Hi guys,

I got this problem when I tried to compile my project on vs2010. 

 

when I tried to "Run custom tool" to compile the ribbon.xml from VS2010, I got the following error.
Error 1 Custom tool error: Generation failed. Error: link.exe failed to generate binary resource .dll file! D:\TBS\TBS\TBS_BA\TBS_BA\Ribbon.xml 1 1 TBS_BA

So I tried to repeat the same procedure on the sample application "01-AddingRibbonSupport" and "02-ApplicationMenuButton", it gave me the same error.
When I checked log file, it looks like UICC and RC ran successfully, only link.exe failed. And also, I tried both win 7 sdk 3.5 and 4.0, they all gave me this error.
Please help me, your help will be appreciated.
Cheers
Jun 7, 2011 at 2:22 PM
Hi,
The ribbon generator is creating and executing a bat file to create the ribbon file. The template can be found here...

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

Maybe there is something wrong with the link for the link.exe. You can modify the template file.

For testing you can do the following:
- Create a copy of template.bat file
- Replace all placeholders in your copy,
- Start Visual Studio Command Prompt and execute it.

Best regards,
Bernhard
Jun 7, 2011 at 3:22 PM

Hi bernhardelbl,

 

Thanks for the quick reply.

 

And I followed your steps to run it via VS's command Prompt, it works fine. 

 

But if I looked at the log file which was generated from VS when I did "run Custom tool", it shows the command like this:

 

"G:\CodeBase\RibbonLib_v2.6>cmd /c "("C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\VC\bin\vcvars32.bat") && ("C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\VC\bin\link.exe" /VERBOSE /NOENTRY /DLL /OUT:"G:\CodeBase\RibbonLib_v2.6\Samples\CS\02-ApplicationMenuButton\RibbonMarkup.ribbon.dll" "G:\CodeBase\RibbonLib_v2.6\Samples\CS\02-ApplicationMenuButton\RibbonMarkup.res")" "

This is definitely wrong because my VS is installed in D drive other than C, and it cannot find the link.exe at all!!

I guess that could be the problem, any idea about what configuration I need to fix it?

 

Jun 7, 2011 at 3:29 PM
Edited Jun 7, 2011 at 3:32 PM

Hi again,
you can hard code the full path (D:\...link.exe) to link.exe and all other VS paths in the template.bat file.

Thanks,
Bernhard

Jun 8, 2011 at 4:23 AM
Edited Jun 8, 2011 at 4:25 AM

Thanks again.

 

But does that mean I need to change that in template.bat manually every time? coz if it is deleted, RibbonGenerator will generate the wrong one again.

Just curious where does RibbonGenerator read those paths and populate into the template.bat?

It seems like it picks up the wrong path from somewhere.... maybe they read from windows registry?

Jun 8, 2011 at 6:33 AM
Edited Jun 8, 2011 at 9:21 AM

Template.bat is just a template. You can modify it once and your modification will not be overwritten until you delete the file.

Try the following:
- Edit C:\Users\<Username>\AppData\Local\RibbonGenerator\Template.bat file
- Hard code your Visual Studio Program Files paths.

-- The last line in orginal template.bat file should look like
cmd /c "("%VS100COMNTOOLS%..\..\VC\bin\vcvars32.bat") && ("%VS100COMNTOOLS%..\..\VC\bin\link.exe" /VERBOSE /NOENTRY /DLL /OUT:"{DllFilename}" "{ResFilename}")"
-- Edit the last line to look like...
cmd /c "("D:\Program Files\<Your Pathes...>\VC\bin\vcvars32.bat") && D:\Program Files\<Your Pathes....>\VC\bin\link.exe" /VERBOSE /NOENTRY /DLL /OUT:"{DllFilename}" "{ResFilename}")"

Look here for more information about how template.bat is created and processed...
http://bernhardelbl.wordpress.com/2010/12/10/ribbongenerator-details-windows-ribbon-for-winforms/

You can also take a look into the source code of RibbonGenerator to discover what and how paths are generated and replaced. The RibbonGenerator only replaces the place holders looking like {Placeholdername}.

 

Another option:

%VS100COMNTOOLS% is an environment variable of your system and can open a Command Prompt and execute "SET". Look for the VS100COMNTOOLS entry, whats in there?


Best regards,
Bernhard