Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 834965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:45:08+00:00 2026-05-15T04:45:08+00:00

We have a Team City Build Server running and want to compile a Visual

  • 0

We have a Team City Build Server running and want to compile a Visual C++ project. So far this would be easy, since I’ve setup our Windows Build Agent with the Windows SDK, but we don’t have a solution / project file.

The project files are instead created with CMake. CMake seems to be a little bit dumb (can’t generate Solution when Visual Studio is not installed), but with some tricks, I could get it to do it. The solution can then be built with MSBuild.

And here comes the problem. For this to work automatically, I need to call the Windows SDK’s SetEnv.cmd. And I can’t seem to find it automatically. It’s in the bin sub directory of the Windows SDK, but neither bin nor the root are in the path, and the %mssdk% environment variable is set by the SetEnv.cmd and is not available beforehand!

Adding the Windows SDK\bin dir to the PATH leads to SetEnv.cmd no longer working (exits with a message like The x86 compilers are not currently installed and Jump target Set_x86 not found.

The start menu link is calling the SetEnv.cmd with the Windows SDK dir as working directory instead. But if I add the root directory to the PATH, Bin\SetEnv.cmd is not available.

How can I find SetEnv.cmd automatically? Even setting an environment variable to the full path of the setenv.cmd doesn’t work, and when I define %mssdk% as the sdk dir, then call %mssdk%\bin\SetEnv doesn’t work as well. I also tried to define %mssdk%, then cd %mssdk%, then calling bin\SetEnv. Also compilers not found in all these cases. It also doesn’t work if I manually cd to the root or bin dir on a command line and then call SetEnv.cmd…

The start menu link works fine though.

For the record, my solution for now, as strange as this is, is the following:

I created a MSBuild file that creates the solution file with CMake on the command line, then invokes the created solution with a MSBuild task. The MSBuild file can be easily built from TeamCity, though I needed some additional tricks to satisfy CMake’s stupid looking for the compiler, though I won’t invoke it thing. Not really satisfying, but it works.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T04:45:08+00:00Added an answer on May 15, 2026 at 4:45 am

    My solution (sets %WindowsSdkPath%, so that SetEnv.cmd could be found under %WindowsSdkPath%Bin\):

    @ECHO OFF
    
    IF "%WindowsSdkVersion%"=="" (
      CALL :SetWindowsSdkVersionHelper HKCU > nul 2>&1
      IF ERRORLEVEL 1 CALL :SetWindowsSdkVersionHelper HKLM > nul 2>&1
      IF ERRORLEVEL 1 GOTO ERROR_NOWSDK
    )
    
    CALL :SetWindowsSdkPathHelper > nul 2>&1
    IF ERRORLEVEL 1 GOTO ERROR_NOWSDK
    GOTO END
    
    :SetWindowsSdkPathHelper
    SET WindowsSdkPath=
    FOR /F "tokens=1,2*" %%i in ('REG QUERY "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\%WindowsSdkVersion%" /V InstallationFolder') DO (
        IF "%%i"=="InstallationFolder" (
            SET "WindowsSdkPath=%%k"
        )
    )
    IF "%WindowsSdkPath%"=="" EXIT /B 1
    EXIT /B 0
    
    :SetWindowsSdkVersion
    CALL :GetWindowsSdkVersionHelper HKCU > nul 2>&1
    IF ERRORLEVEL 1 CALL :GetWindowsSdkVersionHelper HKLM > nul 2>&1
    IF ERRORLEVEL 1 EXIT /B 1
    EXIT /B 0
    
    :SetWindowsSdkVersionHelper
    SET WindowsSdkVersion=
    FOR /F "tokens=1,2*" %%i in ('REG QUERY "%1\SOFTWARE\Microsoft\Microsoft SDKs\Windows" /V "CurrentVersion"') DO (
        IF "%%i"=="CurrentVersion" (
            SET "WindowsSdkVersion=%%k"
        )
    )
    IF "%WindowsSdkVersion%"=="" EXIT /B 1
    EXIT /B 0
    
    :ERROR_NOWSDK
    ECHO The Windows SDK %WindowsSdkVersion% could not be found.
    EXIT /B 1
    
    :END
    

    I was inspired for this by the SetEnv.cmd itself…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Team City as the build server, and I have a msbuild
I'm currently setting up CI for my project and have team city configure and
I have following pom.xml <project> <properties> <buildNumber>dev</buildNumber> </properties> <build> <finalName>${project.artifactId}-${project.version}-${buildNumber}</finalName> </build> </project> This works
I have a team of junior developers and they want to have better understanding
In Team Foundation Server is there a way to have work items in one
I am running TeamCity on a virtual machine. I have installed the new Visual
I have a msdeploy in my nant script(Team City) that is working except it
In using our TeamCity Continuous Integration server we have uncovered some issues that we
I have a team lead who seems to think that business logic is very
I have a team of developers distributed Globally over different time zones. what are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.