Thursday, December 27, 2007 3:32 PM
kolbis
Compile Unmanaged C/C++ During Team Build
In order to compile .NET solutions all we need to do is indicate the path to the solution.
It should look something like this:
<SolutionToBuild Include="$(SolutionRoot)\Application Services\Controls\Controls.sln" />
However, when it comes to native C++ solutions, the above line will not work. What should we do?We need to compile the solution from the command line. There are three tools that can help us compile the solution:
- devenv.exe
- cl.exe
- vcbuild.exe
The devenv.exe is a process that belongs to the Microsoft Visual Studio. It is possible to use it to compile the solution when given a specific configuration, but when invoking the compilation through it we are opening the entire environment.
The second option is the cl.exe which it is the Microsoft® C/C++ Compiler Driver. When we compile C/C++ using any of the options mentioned, we actually invoke it. It compiles file after file and so in order to compile a large project or even a solution, we must provide it with a huge list of files.
Finally, there is the vcbuild.exe. You can use it to build Visual C++ projects and Visual Studio solutions from the command line. Invoking this utility is equivalent to running the Build Project or Build Solution command from the Visual Studio IDE.
So, in my opinion the best method is to use the vcbuild.exe.
Luckily for us, there is a VCBuild Task that can be invoked from the build process. This task wraps vcbuild.exe, which builds Visual C++ projects and solutions that contain Visual C++ projects.
For example:
<VCBuild Projects="@(vcprojects)" Configuration="$(configuration)" Rebuild="true"/>
Enjoy!
תגים:Team Build