Important: Please read the Qt Code of Conduct -

Qt Add-in VS2008 project with MSbuild fails to set QTDIR

  • Hi,

    We have been migrating to TFS and now we have encoutered a problem. Let me first explain how the development setup is.
    Each developer is working in VS2008 (required since we are developing on a WinCE platform). The solution is cross-platfrom for Win32 and WinCE. On the developer machine everything is running perfectly.
    Even when we try it with the command line (Qt add-in is supporting console) then everyting is building fine. So we can assume that the QTDIR is set correctly by the Qt add-in. The command to build on the development machine is 'devenv'.

    Now since TFS is using Msbuild we have encountered the probem that the QTDIR variable is not set by the Qt add-in. I'm not sure if it has something to do with VS2010 since when we try it on the development machine (VS2008) with msbuild then it's also failing.
    From the logging from msbuild I guess that the QTDIR is not set, but please correct me if I'm wrong

    This is the output from msbuild:
    Microsoft (R) Build Engine Version 3.5.30729.5420
    [Microsoft .NET Framework, Version 2.0.50727.5448]
    Copyright (C) Microsoft Corporation 2007. All rights reserved.

    Using solution cache file "c:\Temp\TestQT\Sky.App\Source\SkyApp.sln.cache" for configuration "Debug|Win32" and tools version "3.5".
    Build started 29/02/2012 17:33:57.
    Project "c:\Temp\TestQT\Sky.App\Source\SkyApp.sln" on node 0 (Rebuild target(s)).
    Initial Properties:
    MSBuildToolsVersion = 3.5
    PSModulePath = C:\Windows\system32\WindowsPowerShell\v1.0\Modules
    PUBLIC = C:\Users\Public
    SESSIONNAME = Console
    SolutionDir = c:\Temp\TestQT\Sky.App\Source
    SolutionExt = .sln
    SolutionFileName = SkyApp.sln
    SolutionName = SkyApp
    SolutionPath = c:\Temp\TestQT\Sky.App\Source\SkyApp.sln
    SystemDrive = C:
    SystemRoot = C:\Windows
    TargetFrameworkVersion = v3.5
    TEMP = C:\Users\PETERJ~1\AppData\Local\Temp
    TFSPowerToolDir = C:\Program Files (x86)\Microsoft Team Foundation Server 2010 Power Tools
    TMP = C:\Users\PETERJ~1\AppData\Local\Temp
    USERNAME = peterjand
    USERPROFILE = C:\Users\peterjand
    VBOX_INSTALL_PATH = C:\Program Files\Oracle\VirtualBox
    VCINSTALLDIR = c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC
    VS100COMNTOOLS = c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools
    VS90COMNTOOLS = c:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools
    VSINSTALLDIR = c:\Program Files (x86)\Microsoft Visual Studio 9.0
    windir = C:\Windows
    WindowsSdkDir = C:\Program Files\Microsoft SDKs\Windows\v6.0A\

    Initial Items:

    Building with tools version "3.5".
    Target "ValidateSolutionConfiguration: (TargetId:0)" in file "c:\Temp\TestQT\Sky.App\Source\SkyApp.sln.cache" from project "c:\Temp\TestQT\Sky.App\Source\SkyApp.sln":
    Locating vcbuild.exe: found at "c:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE....\vc\vcpackages\vcbuild.exe". (TaskId:10)
    Command: (TaskId:10)
    c:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE....\vc\vcpackages\vcbuild.exe /rebuild c:\Temp\TestQT\Sky.App\Source\UI_TxMax\UI_TxMax.vcproj "Debug|Win32" (TaskId:10)
    The "VCBuild" task is using "VCBuild.exe" from "c:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE....\vc\vcpackages\vcbuild.exe". (TaskId:10)
    Microsoft (R) Visual C++ Project Builder - Command Line Version 9.00.21022 (TaskId:10)
    Copyright (C) Microsoft Corporation. All rights reserved. (TaskId:10)
    Rebuild started: Project: UI_TxMax, Configuration: Debug|Win32 (TaskId:10)
    Deleting intermediate and output files for project 'UI_TxMax', configuration 'Debug|Win32' (TaskId:10)
    Moc'ing topstatusbarwidget.h... (TaskId:10)
    The system cannot find the path specified. (TaskId:10)
    Project : error PRJ0019: A tool returned an error code from "Moc'ing topstatusbarwidget.h..."
    Project : warning PRJ0018: The following environment variables were not found:
    $(QTDIR) (TaskId:10)
    Build log was saved at "file://c:\Temp\TestQT\Sky.App\Source\UI_TxMax\Win32\Debug\BuildLog.htm" (TaskId:10)
    UI_TxMax - 1 error(s), 0 warning(s) (TaskId:10)
    The command exited with code 1. (TaskId:10)

  • welcome to devnet

    I am not sure but I would assume that vsaddin is setting QTDIR only for the environment of msvc.
    Where or how are you starting msbuild?
    Do you start it from inside of visual studio or outside?

  • Hi,

    Both of them (devenv and msbuild) are started from the command prompt from visual studio. I did not went through the UI to go to the console I went from the shortcut provided in the 'start menu'.

    Both command prompts should have been the same.

  • [quote author="deweirdt" date="1330538425"]Hi,
    Both of them (devenv and msbuild) are started from the command prompt from visual studio. I did not went through the UI to go to the console I went from the shortcut provided in the 'start menu'.
    I assume you mean with 'start menu' the part started probably on the left upper corner in vs 2008/2010. I have just vs 2005, so that is a bit different.
    I have started the command prompt through vs2005 via 'tools'->'Visual Studio Command Prompt'. the command "set qt" shows among other settings starting with qt also QTDIR. I do not see QTDIR when using the standard command prompt.

    i guess you should file a bug report then on "JIRA":
    Please put a link here to your filing.

    As a solution you can introduce the QTDIR in your system environment. I am not sure what that means for your compilations for wince. I am using two different settings. QTDIR for desktop and QTDIRCE for wince compilations. The drawback is that you may have to change all settings in the wince portion.

  • Hi,

    No I did not went through the visual studio itself. When I've installed VS then the installer created a shortcut in the startmenu (from windows) to go directly to the console.

    I cannot use the enviroment variable QTDIRCE and another since when creating a common project then you'll have to manually change the QTDIR command to QTDIRCE. We have done this in the past and this is resulting into many time changing the project files before resulting into a good build.

    I've created an bug report. You can find it at

  • i have found also the "visual studio 2005 command prompt" link. It has been introduced by the vs installer as well. However, when starting there it does not show QTDIR in the environment either.
    I think you have to go through the IDE and start the command from there. In that case vsaddin is started as well. This makes sure that the environment is updated as you need.

  • Well not completely true, the Qt add-in you can configure (add-in manager) to work with the command line. This means when you then call devenv that QTDIR will be set by the Qt add-in (which is perfectly). However when you do the same with msbuild then this is not working.

  • ok, outside of my experience. But thanks for sharing, I have learnt a bit more :-)

Log in to reply