vcTasks: an Ant task for compiling projects with Visual Studio
What is this?
vcTasks is a set of tasks for Ant.
It allows developers to create scripts that compile Visual Studio solutions. Currently we support the compilation using three different versions of VS: 2003, 2005, 2008, 2010 and 2012.
You just have to copy the vcTasks.jar file to the ./lib folder of your ant distribution.
How to use it?
<project name="vcTasksExample"> <taskdef resource = "vcTasks.properties" classpath="vcTasks"/> <!-- Visual Studio 2005 (VC8) --> <vc8 projectfolder="VC8" buildmode="release" rebuild="true" logfile="vc8.log"> <targets dir="MySource" includes="HelloWorld.sln"/> </vc8> <!-- Visual Studio 2008 (VC9) --> <vc9 projectfolder="VC9" buildmode="debug" rebuild="false" logfile="vc9.log"> <targets dir="ProjectsDir" includes="HelloWorld.sln"/> </vc9> </project> <!-- Visual Studio 2010 (VC10) --> <vc10 projectfolder="VC10" buildmode="debug" rebuild="false" logfile="vc10.log"> <targets dir="ProjectsDir" includes="HelloWorld.sln"/> </vc10> <!-- Visual Studio 2012 (VC11) --> <vc11 projectfolder="VC11" buildmode="debug" rebuild="false" logfile="vc11.log"> <targets dir="ProjectsDir" includes="HelloWorld.sln"/> </vc11> </project>
How does it work?
The ant tasks checks different environment variables to found the Visual Studio tools. In particular, it uses those variables that the VS installer set: VS70COMNTOOLS, VS80COMNTOOLS, VS90COMNTOOLS, VS10COMNTOOLS and VS11COMNTOOLS. Using them vcTasks are able to found the different Visual Studio versions.
If the variable is not found, vcTasks relies on the PATH variable; it just will execute the compiler tool, hoping that the operating system will find it.
vcTasks works also with the Visual Studio Express editions even though the tools used are differents. The only (and logic) limitation is that the .sln should be compatible with the express edition. Otherwise the compilation will fail.
|Version||Source distribution||Binary distribution|
The original development of the tasks was made by John Arrizza. In fact, only small modifications were made to the original version in order to support modern Visual Studio versions and the Express editions.
The software is distributed under the terms of the GNU General Public License.