PDA

View Full Version : Qt Creator Build a Qt project using MSBuild



franco.amato
26th June 2020, 17:11
Good morning forum,
I need to build a Qt project using only MSBuid (without installing Visual Studio). Can you help me?
Is possible to create a Qt Creator kit based on MSBuild as build tool? I searched on internet without any result.
Thank to all.
Franco

d_stranz
26th June 2020, 23:40
MSBuild uses the vcxproj files as input to control the build process. These are XML files containing a series of build steps and commands. These invoke the compiler, linker, and various other tools required to build a project, much in the same way a Qt Creator kit does. You still need a compiler, linker, and all of the other tools installed - MSBuild does not include them. So a Qt Creator kit and MSBuild are two different ways of doing the same thing and are compatible only at the level of the tools each one uses to build a project.

You've probably found the MSBuild documentation from Microsoft (https://docs.microsoft.com/en-us/cpp/build/msbuild-visual-cpp). It has examples of how to build a vcxproj file by hand. Normally you would use Visual Studio for this, but if you have a project file, you can run MSBuild from the command line.

Is there a reason you must use MSBuild standalone and not with a Community Edition of Visual Studio?

You might also consider cmake. From what I understand, Qt6 will be using that for builds.

franco.amato
27th June 2020, 00:43
Thank you very much d_stranz.
We can not use VS2019 community edition because it's free only for companies having up to 5 employees and the company has 10.
You told "You still need a compiler, linker, and all of the other tools installed" where can I get them? We also tried using mingw but our work depends on some sdk build for VS and not for mingw, so it simply does not work.
I though that msbuid contains all the necessary tools to create the executables.
Thanx again

d_stranz
27th June 2020, 16:36
I though that msbuild contains all the necessary tools to create the executables.

No, unfortunately, MSBuild is like QtCreator, make, cmake, ant, or any other build system - it is a controller that helps manage all of the project dependencies and build the parts using the right tools in the right order. It doesn't come with the toolchain - the compilers, linkers, etc. That's what makes them so flexible - you can supply your own. Some of the MSBuild examples actually use building a Java app as the project, nothing involving C++ at all.

I don't think you have much choice except to buy the most basic version of Visual Studio. I don't know if Microsoft sells just the tools without the IDE.