[Solved] On Windows 7 64bit pre-build events generates errors

Dec 8, 2009 at 10:15 AM
Edited Dec 8, 2009 at 10:18 AM

I'm trying to compile and run the samples but I get the following errors for the pre-build events. I am running Visual Studio 2008 SP1 on Windows 7 with Windows 7 SDK installed. Can you help me?

cannot open input file '...\RibbonTest\RibbonMarkup.res'
The command ".bml" /res:"...\RibbonTest\RibbonMarkup.rc"
"%PROGRAMFILES%\Microsoft SDKs\Windows\v7.0\Bin\rc.exe" /v "...\RibbonTest\RibbonMarkup.rc"
cmd /c "("C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\..\..\VC\bin\vcvars32.bat") && ("C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\..\..\VC\bin\link.exe" /VERBOSE /NOENTRY /DLL /OUT:"...\RibbonTest\bin\Release\RibbonTest.ribbon.dll" "...\RibbonTest\RibbonMarkup.res")"" exited with code 1181.

Coordinator
Dec 8, 2009 at 10:51 PM

Please send me the whole compilation output.

Also, try to run the prebuild commands yourself from cmd. In this way some of the utilities provide more info on the problem.
[when doing so, note that you have to change the visual studio directory macros to the actual directories in your project]

 

Dec 9, 2009 at 6:04 AM

Hi! Thanks for the quick responce.

I have already tried to run the commands manually from cmd and they seem to work just fine. I saw the .bml and .rc files created as expected.

What I sent before was the errors from the 'Error List' window. This is from the 'Output' window:

------ Build started: Project: 02-ApplicationMenuButton, Configuration: Debug Any CPU ------
"%PROGRAMFILES%\Microsoft SDKs\Windows\v7.0\Bin\UICC.exe" "F:\Windows Ribbon for WinForms\Samples\02-ApplicationMenuButton\RibbonMarkup.xml" "F:\Windows Ribbon for WinForms\Samples\02-ApplicationMenuButton\RibbonMarkup.bml" /res:"F:\Windows Ribbon for WinForms\Samples\02-ApplicationMenuButton\RibbonMarkup.rc"
"%PROGRAMFILES%\Microsoft SDKs\Windows\v7.0\Bin\rc.exe" /v "F:\Windows Ribbon for WinForms\Samples\02-ApplicationMenuButton\RibbonMarkup.rc"
cmd /c "("c:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\..\..\VC\bin\vcvars32.bat") && ("c:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\..\..\VC\bin\link.exe" /VERBOSE /NOENTRY /DLL /OUT:"F:\Windows Ribbon for WinForms\Samples\02-ApplicationMenuButton\bin\Debug\02-ApplicationMenuButton.ribbon.dll" "F:\Windows Ribbon for WinForms\Samples\02-ApplicationMenuButton\RibbonMarkup.res")"

The system cannot find the path specified.
The system cannot find the path specified.
Setting environment for using Microsoft Visual Studio 2008 x86 tools.
Microsoft (R) Incremental Linker Version 9.00.30729.01
Copyright (C) Microsoft Corporation.  All rights reserved.


Starting pass 1
LINK : fatal error LNK1181: cannot open input file 'F:\Windows Ribbon for WinForms\Samples\02-ApplicationMenuButton\RibbonMarkup.res'
C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(895,9): error MSB3073: The command ""%PROGRAMFILES%\Microsoft SDKs\Windows\v7.0\Bin\UICC.exe" "F:\Windows Ribbon for WinForms\Samples\02-ApplicationMenuButton\RibbonMarkup.xml" "F:\Windows Ribbon for WinForms\Samples\02-ApplicationMenuButton\RibbonMarkup.bml" /res:"F:\Windows Ribbon for WinForms\Samples\02-ApplicationMenuButton\RibbonMarkup.rc"
C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(895,9): error MSB3073: "%PROGRAMFILES%\Microsoft SDKs\Windows\v7.0\Bin\rc.exe" /v "F:\Windows Ribbon for WinForms\Samples\02-ApplicationMenuButton\RibbonMarkup.rc"
C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(895,9): error MSB3073: cmd /c "("c:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\..\..\VC\bin\vcvars32.bat") && ("c:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\..\..\VC\bin\link.exe" /VERBOSE /NOENTRY /DLL /OUT:"F:\Windows Ribbon for WinForms\Samples\02-ApplicationMenuButton\bin\Debug\02-ApplicationMenuButton.ribbon.dll" "F:\Windows Ribbon for WinForms\Samples\02-ApplicationMenuButton\RibbonMarkup.res")"
C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(895,9): error MSB3073: " exited with code 1181.
Done building project "02-ApplicationMenuButton.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

Thanks!

Dec 9, 2009 at 2:28 PM

Hello again and sorry for the double post!

I have recreated the first sample from scratch in VB, which is my preferred language. Again, I get the same errors for the pre-build events.
When I execute the commands myself from a batch file, everything works perfectly.
Note that I have substituted all visual studio directory macros with the paths I get from the visual studio output window.
This is the batch file:

echo off
cls
"%PROGRAMFILES%\Microsoft SDKs\Windows\v7.0\Bin\UICC.exe" "F:\Visual Studio Projects\RibbonTest\RibbonTest\RibbonMarkup.xml" "F:\Visual Studio
Projects\RibbonTest\RibbonTest\RibbonMarkup.bml" /res:"F:\Visual Studio Projects\RibbonTest\RibbonTest\RibbonMarkup.rc"
"%PROGRAMFILES%\Microsoft SDKs\Windows\v7.0\Bin\rc.exe" /v "F:\Visual Studio Projects\RibbonTest\RibbonTest\RibbonMarkup.rc"
cmd /c "("c:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\..\..\VC\bin\vcvars32.bat") && ("c:\Program Files (x86)\Microsoft Visual
Studio 9.0\Common7\IDE\..\..\VC\bin\link.exe" /NOENTRY /DLL /OUT:"F:\Visual Studio Projects\RibbonTest\RibbonTest\bin\Debug\RibbonTest.Ribbon.dll" "F:
\Visual Studio Projects\RibbonTest\RibbonTest\RibbonMarkup.res")"
pause

This is what I get after executing the batch file:

F:\Visual Studio Projects\RibbonTest\RibbonTest\RibbonMarkup.xml(9): warning SC2
002 : Undefined property: 'ApplicationMenu'. Using default value.
F:\Visual Studio Projects\RibbonTest\RibbonTest\RibbonMarkup.xml(9): warning SC2
002 : Undefined property: 'Tab'. Using default value.
F:\Visual Studio Projects\RibbonTest\RibbonTest\RibbonMarkup.xml(9): warning SC2
002 : Undefined property: 'QuickAccessToolbar'. Using default value.
F:\Visual Studio Projects\RibbonTest\RibbonTest\RibbonMarkup.xml : warning SC200
1 at /Application/Application.Views/Ribbon/Ribbon.ApplicationMenu/ApplicationMen
u: Undefined Command on element.
F:\Visual Studio Projects\RibbonTest\RibbonTest\RibbonMarkup.xml : warning SC200
1 at /Application/Application.Views/Ribbon/Ribbon.Tabs/Tab: Undefined Command on
 element.
Header file generation successful: '(null)'.
Ribbon markup file validation successful: 'F:\Visual Studio Projects\RibbonTest\
RibbonTest\RibbonMarkup.xml'.
Ribbon resource file generation successful: 'F:\Visual Studio Projects\RibbonTes
t\RibbonTest\RibbonMarkup.rc'.
Microsoft (R) Windows (R) Resource Compiler Version 6.1.7600.16385
Copyright (C) Microsoft Corporation.  All rights reserved.
Using codepage 1253 as default
Creating F:\Visual Studio Projects\RibbonTest\RibbonTest\RibbonMarkup.res
F:\Visual Studio Projects\RibbonTest\RibbonTest\RibbonMarkup.rc...
Writing UIFILE:APPLICATION_RIBBON,      lang:0x409,     size 1042
Writing STRING:3751,    lang:0x409,     size 104
Setting environment for using Microsoft Visual Studio 2008 x86 tools.
Microsoft (R) Incremental Linker Version 9.00.30729.01
Copyright (C) Microsoft Corporation.  All rights reserved.
LINK : warning LNK4068: /MACHINE not specified; defaulting to X86
Press any key to continue . . .

After that everything works as expected. I do not know what seems to be the problem.

If it is of any help, I'm running the 64-bit edition of Windows 7.

Thanks!

Coordinator
Dec 18, 2009 at 3:14 PM

It seems that the environment variable %ProgramFiles% on your 64bit system is the cause for your problem.

64 bit systems has two addional environment variables:
%ProgramFiles(x86)% which defaults to "C:\Program Files (x86)" and
%ProgramW6432% which defaults to C:\Program Files

The value of %ProgramFiles% on 64bit systems depends on whether the calling process is itself a 32bit process or 64bit process.

Try to replace %ProgramFiles% with both %ProgramFiles(x86)% and %ProgramW6432% and let us know which one works on your system.
Unfortunately, I don't have a 64bit machine to test it myself.

Jan 21, 2010 at 9:03 PM

You were right; %ProgramFiles% was causing the problem.

Visual Studio 2008 is a 32-bit process, so %ProgramFiles% expands to "C:\Program Files (x86)".
On the other hand, Windows 7 SDK is 64-bit and is installed in "C:\Program Files\Microsoft SDKs\Windows\v7.0".

The correct pre-build event for 64-bit Windows is:

"%ProgramW6432%\Microsoft SDKs\Windows\v7.0\Bin\UICC.exe"  "$(ProjectDir)RibbonMarkup.xml" "$(ProjectDir)RibbonMarkup.bml" /res:"$(ProjectDir)RibbonMarkup.rc"
"%ProgramW6432%\Microsoft SDKs\Windows\v7.0\Bin\rc.exe" /v "$(ProjectDir)RibbonMarkup.rc"
cmd /c "("$(DevEnvDir)..\..\VC\bin\vcvars32.bat") && ("$(DevEnvDir)..\..\VC\bin\link.exe" /VERBOSE /NOENTRY /DLL /OUT:"$(ProjectDir)$(OutDir)$(TargetName).ribbon.dll" "$(ProjectDir)RibbonMarkup.res")"

Thanks!