title: Visual Studio custom build event always executing
body: <p>I am using the <a href="http://www.codesynthesis.com/products/odb/" rel="noreferrer">odb</a> compiler as a custom build tool.  The build tool is always executing even though the input file is not changing.  </p>
  
  <p>The command line:  </p>
  
  <pre><code>odb -Ic:\menuplan\src\ingredient -o c:\menuplan\src\ingredient  
   -d mysql --hxx-prologue "#include \"odb/traits.hxx\"" --generate-query  
  --generate-schema --schema-format separate 
  c:\menuplan\src\ingredient\ing_odb_category.hpp`  
  </code></pre>
  
  <p>The input file is:<br>
  <code>ing_odb_category.hpp</code>.  </p>
  
  <p>The outputs:  </p>
  
  <pre><code>ing_odb_category-odb.hxx;ing_odb_category-odb.ixx;ing_odb_category-odb.cxx;ing_odb_category-schema.cxx   
  </code></pre>
  
  <p>The additional dependencies:<br>
  <code>ing_odb_category.hpp</code></p>
  
  <p>The description:<br>
  <code>odb ing_odb_category.hpp</code>  </p>
  
  <p>The output from Visual Studio 2010:  </p>
  
  <pre><code>2&gt;------ Build started: Project: vs_2010, Configuration: Debug Win32 ------
  2&gt;  odb ing_odb_category.hpp
  </code></pre>
  
  <p>The <code>odb</code> tool takes the <code>ing_odb_category.hpp</code> as input and produces <code>ing_odb_category-odb.hxx</code>, <code>ing_odb_category-odb.ixx</code>,<code>ing_odb_category-odb.cxx</code>,<code>ing_odb_category-schema.cxx</code> files.  </p>
  
  <p>I can build the solution many times in a row and the custom build event will always run, even though the <code>ing_odb_category.hpp</code> file never changes.  </p>
  
  <p>How can I make Visual Studio only perform the custom build if the header file changes?</p>
  
  <p>From the vcxproj file:</p>
  
  <pre><code>&lt;CustomBuild Include="..\ing_odb_category.hpp"&gt;
    &lt;Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"&gt;odb -Ic:\menuplan\src\ingredient -o c:\menuplan\src\ingredient -d mysql --hxx-prologue "#include \"odb/traits.hxx\"" --generate-query --generate-schema --schema-format separate  c:\menuplan\src\ingredient\ing_odb_category.hpp&lt;/Command&gt;
    &lt;Command Condition="'$(Configuration)|$(Platform)'=='Debug_Static_Unicode|Win32'"&gt;odb -Ic:\menuplan\src\ingredient -o c:\menuplan\src\ingredient -d mysql --hxx-prologue "#include \"odb/traits.hxx\"" --generate-query --generate-schema --schema-format separate  c:\menuplan\src\ingredient\ing_odb_category.hpp&lt;/Command&gt;
    &lt;Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"&gt;odb ing_odb_category.hpp&lt;/Message&gt;
    &lt;Message Condition="'$(Configuration)|$(Platform)'=='Debug_Static_Unicode|Win32'"&gt;odb ing_odb_category.hpp&lt;/Message&gt;
    &lt;Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"&gt;ing_odb_category-odb.hxx;ing_odb_category-odb.ixx;ing_odb_category-odb.cxx;ing_odb_category-schema.cxx&lt;/Outputs&gt;
    &lt;Outputs Condition="'$(Configuration)|$(Platform)'=='Debug_Static_Unicode|Win32'"&gt;ing_odb_category-odb.hxx;ing_odb_category-odb.ixx;ing_odb_category-odb.cxx;ing_odb_category-schema.cxx&lt;/Outputs&gt;
    &lt;AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"&gt;ing_odb_category.hpp&lt;/AdditionalInputs&gt;
  &lt;/CustomBuild&gt;
  </code></pre>
  
  <p>Environment:  </p>
  
  <ul>
  <li>Visual Studio 2010</li>
  <li>Windows 7 - 64bit</li>
  </ul>