visual studio - Emulate Devenv/Runexit under MSBuild -
i new msbuild , busy automating tests of visual studio solutions.
i worked command line of devenv
, provides convenient /runexit
mode of operation. manual:
/runexit (devenv.exe) compiles , runs specified solution, minimizes ide when solution run, , closes ide after solution has finished running.
this functionality need. migrating msbuild. have discovered project files in solution can directly used building, default target precisely build.
what can handle different target, have same effect /runexit
? can me through maze ?
this basic target runs projects' output file:
<target name="runtarget"> <exec command="$(targetpath)" /> </target>
for c++ unittests use this; it's property sheet it's easy add project without needing manually modify it. automatcially runs output after build there no need specify target , works same vs , command line. in vs you'll unittest errors frameworks unittest++ or catch displayed right away in error list, can doubleclick them. unittestextrapath
property can set elsewhere in case (e.g. on buildserver want keep path clean need modify run built exes).
<?xml version="1.0" encoding="utf-8"?> <project toolsversion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <importgroup label="propertysheets" /> <propertygroup label="usermacros" /> <propertygroup /> <itemdefinitiongroup /> <itemgroup /> <!--used aftertargets="afterbuild", unusable since failing test marks build unsuccessful, in way vs try build again. consequence debugging in vs impossible since vs build project before starting debugger building fails time , time again.--> <target name="rununittests" aftertargets="finalizebuildstatus"> <exec condition="$(unittestextrapath)!=''" command="(set path="%path%";$(unittestextrapath)) & $(targetpath)" /> <exec condition="$(unittestextrapath)==''" command="$(targetpath)" /> </target> </project>
Comments
Post a Comment