title: How to call the a unit test target in a project from a 'solution' project
body: <p>I'm trying to get Team City to build my .NET solution and run my nUnit tests.</p>
  
  <p>I know I can modify the individual projects and tell them always run the unit tests. I <em>don't</em> want the unit tests to run when I click "build" in visual studio, but I <em>do</em> want the unit tests to run when Team City kicks off a msbuild task.</p>
  
  <p>I tried "msbuild solutionname.sln" and gave team city the targets of "BUILD" and my custom build tag of "TEST".  However, msbuild can't find any specified target when invoked against a sln solution.  <em>So,</em> I ran msbuild to convert my solution into a project which has a target like this:</p>
  
  <pre><code>  &lt;Target Name="Build"&gt;
      &lt;MSBuild  Projects="@(BuildLevel0)" &gt;
    &lt;/Target&gt;
  </code></pre>
  
  <p>I naively thought I could write a new task like this:</p>
  
  <pre><code>&lt;Target Name="BuildAndTest"&gt;
      &lt;CallTarget Targets="Build"/&gt; &lt;!-- This builds everything in solution --&gt;
      &lt;CallTarget Targets="Test"/&gt; &lt;!-- DOES NOT WORK. This target exists in project that gets built by this solution --&gt;
  &lt;/Target&gt;
  </code></pre>
  
  <p>The nunit target looks like this:</p>
  
  <pre><code>  &lt;Target Name="Test" DependsOnTargets="Build" Condition=" '$(Configuration)' == 'Release'"&gt;
      &lt;NUnit Assemblies="$(OutputPath)\Tsa.BaseTest.dll" ContinueOnError="false" ToolPath="C:\Program Files\NUnit 2.5.2\bin\net-2.0\" DisableShadowCopy="true" OutputXmlFile="$(OutputPath)\nunit-results.xml" /&gt;
    &lt;/Target&gt;
  </code></pre>
  
  <p>As you can see, it references OutputPath, which only the project knows--the solution doesn't  have reference to $OutputPath, else I'd just put all the test targets into the "solution project".</p>
  
  <p>Any suggestions on how I can get this to work?</p>