title: Using MSBuild to Build Multiple Configurations
body: <p>I'm trying to edit my project file to enable me to have a project that builds multiple build configs at once. I've done this using a batching approach and using the MSBuild task (see below). </p>
  
  <p>If I run the script, I get an this error:</p>
  
  <blockquote>
    <p>Error 103 The OutputPath property is
    not set for project
    "ThisMSBuildProjectFile.csproj".
    Please check to make sure that you
    have specified a valid combination of
    Configuration and Platform for this
    project.  Configuration='Debug' 
    Platform='AnyCPU'.</p>
  </blockquote>
  
  <p>I get this if I add or omit the OutputPath from the MSBuild task. If used the VS2010 debugger to step through the script and the MSBuild Task is called - the debugger steps into the file again and then steps into OutputPath, so afaik, it <em>should</em> pick that value up, no? </p>
  
  <p>Any help for this would be greatly appreciated - it's driving me crazy. Thanks, Paul.</p>
  
  <p>ThisMSBuildProjectFile.csproj (surplus stuff taken out):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"&gt;
  
    &lt;!-- Only Import normal targets if not building multiple projects --&gt;
    &lt;Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" Condition="'$(Configuration)|$(Platform)' != 'AllBuild|AnyCPU' "/&gt;
  
    &lt;PropertyGroup Condition=" '$(Configuration)|$(Platform)' == '' "&gt;
      &lt;DebugType&gt;pdbonly&lt;/DebugType&gt;
      &lt;Optimize&gt;true&lt;/Optimize&gt;
      &lt;OutputPath&gt;C:\Folder\Etc\Output\$(Configuration)\&lt;/OutputPath&gt;
      &lt;OutDir&gt;C:\Folder\Etc\Output\$(Configuration)\&lt;/OutDir&gt;
      &lt;BaseOutputPath&gt;C:\Folder\Etc\Output\$(Configuration)\&lt;/BaseOutputPath&gt;
      &lt;DefineConstants&gt;TRACE&lt;/DefineConstants&gt;
      &lt;ErrorReport&gt;prompt&lt;/ErrorReport&gt;
      &lt;WarningLevel&gt;4&lt;/WarningLevel&gt;
    &lt;/PropertyGroup&gt;
  
    &lt;!-- Common --&gt;
    &lt;PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "&gt;
      &lt;Platform&gt;AnyCPU&lt;/Platform&gt;
      &lt;!-- Repeated properties from above here (including, of course, OutputPath) --&gt;  
     &lt;/PropertyGroup&gt;
    &lt;PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "&gt;
      &lt;!-- Repeated properties from above here (including, of course, OutputPath) --&gt; 
    &lt;/PropertyGroup&gt;
  
    &lt;ItemGroup&gt;
      &lt;Projects Include="C:\Folder\Etc\ThisMSBuildProjectFile.csproj" /&gt;
    &lt;/ItemGroup&gt;
  
     &lt;!-- Call this project file again, but with a different configuration - if this was working, this would call multiple  build configs --&gt;
    &lt;Target Name="Build" Condition="'$(Configuration)|$(Platform)' == 'AllBuild|AnyCPU' "&gt;
      &lt;Message Text="hm!"/&gt;
      &lt;!-- Tried thiswith and without the OutputPath property - makes no difference. --&gt;
     &lt;MSBuild  Projects="@(Projects)" Properties="Configuration=Debug;OutputPath=C:\Folder\Etc\Output\" ToolsVersion="4.0" Condition="'$(Configuration)|$(Platform)' == 'AllBuild|AnyCPU' "/&gt;
   &lt;/Target&gt;
  
     &lt;PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AllBuild|AnyCPU' "&gt;
      &lt;!-- Repeated properties from above here (including, of course, OutputPath) --&gt; 
    &lt;/PropertyGroup&gt;
  
    &lt;!-- Project files --&gt;
    &lt;ItemGroup&gt;
      &lt;Reference Include="System" /&gt;
      &lt;Reference Include="System.Core" /&gt;
    &lt;/ItemGroup&gt;
    &lt;ItemGroup&gt;
      &lt;Compile Include="Properties\AssemblyInfo.cs" /&gt;
      &lt;Compile Include="Blah\Blah.cs" /&gt;
    &lt;/ItemGroup&gt;
  </code></pre>
  
  <p>    </p>