Sounds great, but I ran into a couple of problems:
- MSBUILD : warning MSB6006: "MSTest.exe" exited with code 1.
- how to avoid to run the unit tests for the build to deploy
http://stackoverflow.com/questions/5284174/mstest-fails-when-running-unit-tests-as-part-of-ci-using-tfs-2008
stackoverflow.com/questions/2720057/build-failing-vs2010-solution-on-tfs2008
the solution for me was:
http://blog.aggregatedintelligence.com/2011/03/vs2010-tfs-2008-and-unit-tests.html
and i added this to my tfsbuild.proj
<PropertyGroup>
<TestToolsTaskToolPath>
C:\Program Files (x86)\Microsoft Visual Studio 10.0\
Common7\IDE\MSTest.exe
</TestToolsTaskToolPath>
</PropertyGroup>One problem done one to go.
I searched a while to find the right solution but it was difficult to find but so simple.
I have found these solutions but I knew it must be simpler:
- http://social.msdn.microsoft.com/Forums/pl-PL/tfsbuild/thread/f62a057b-4692-443e-b047-4a50330d112d
- http://blogs.msdn.com/b/aaronhallberg/archive/2007/10/19/running-unit-tests-for-individual-configurations-with-team-build.aspx
<ItemGroup
Condition=" '$(Configuration)' == 'S_TfsBuild' ">
<TestContainer Include="$(OutDir)\%2aTest%2a.dll"/>
</ItemGroup>and my build configuration looks like this:
<ItemGroup>
<!-- CONFIGURATIONS
The list of configurations to build.
To add/delete configurations,
edit this value. For example,
to add a new configuration, add the following lines:
<ConfigurationToBuild Include="Debug|x86">
<FlavorToBuild>Debug</FlavorToBuild>
<PlatformToBuild>x86</PlatformToBuild>
</ConfigurationToBuild>
The Include attribute value should be unique for each
ConfigurationToBuild node.
-->
<ConfigurationToBuild Include="Test|Any CPU">
<FlavorToBuild>Test</FlavorToBuild>
<PlatformToBuild>Any CPU</PlatformToBuild>
</ConfigurationToBuild>
<ConfigurationToBuild Include="S_TfsBuild|Any CPU">
<FlavorToBuild>S_TfsBuild</FlavorToBuild>
<PlatformToBuild>Any CPU</PlatformToBuild>
</ConfigurationToBuild>
</ItemGroup>
