For those who don't know about MSBuild, please check my latest post MSBuild.
MSBuild is the utility made by microsoft for command line building, one replacement for the Unix make system. MSBuild could be directly applied to the C# or VB Projects, and by that we can add tasks to tell the MSBuild utility that we want them to be made with/before/after the compilation process. VCBuild is the utility provided with visual studio .net for building the visual C++ projects of the visual studio .net. Unfortunately, the VCBuild doesn't have the luxury of adding tasks to the building process. The question now, how can we make use of the visual studio projects for C++, with making some sort of command line building that gives us the freedom to really automate that process ?
The key for this operation is that MSBuild provices a built-in task for VCBuild. We can make a seperate file that the vcproj file, and use it to execute VCBuild over the vcproj file we have to make the operation we want. The good thing is that the VCBuild task of the MSBuild gives us the real control over the compilation process, like if we are actually making the compilation of our own. Follows are some examples for the use of the VCBuild tasks:
<VCBuild Projects="MyProject.vcproj" Clean="true" />
This line asks the compiler to clean the project MyProject.vcproj
< VCBuild Projects = "MyProject.vcproj"
Configuration = "Release|Win32" />This line asks the compiler to build the project MyProject.vcproj with the configuration "Release|Win32"
using such command we can build the complete set of configurations we would like to have (for cleaning, building in debug, building in release, and anything else we want), besides making any operation we would like to consider as a build event (like copying the output file to some directory, and so on) with each. Example of an MSBuild project file for VC Projects is attached with this post.
Another Trick: Packing Projects into a solution
Like it is that VCBuild is a task that can be performed within MSBuild tasks, MSBuild is a task that can be performed withing MSBuild project files too. Using such task we can make packing for our projects to make a solution-like file, just the way we did it before with the VCBuild.
No comments:
Post a Comment