title: Delphi XE custom build target is always disabled
body: <p>I've created a custom MSBuild <code>.targets</code> file that I've included in a Delphi XE project via the IDE and enabled it from the Project Manager's context menu. Although the file validates, it always gets disabled after I re-save the project file.</p>
  
  <p>Here's a simplified version of the targets file, named <code>Custom.targets</code>.</p>
  
  <pre><code>&lt;Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;
    &lt;Target Name="Hello"&gt;
      &lt;Message Text="Hello from custom target"/&gt;
    &lt;/Target&gt;
  &lt;/Project&gt;
  </code></pre>
  
  <p>As a stand alone file this works as expected: typing...</p>
  
  <pre><code>MSBuild Custom.target /t:Hello
  </code></pre>
  
  <p>...at the command line gives the expected message.    </p>
  
  <p>Adding <code>Custom.targets</code> to a Delphi project via the IDE displays the file in the Project Manager as expected, and the <code>.dproj</code> file now contains the line...</p>
  
  <pre><code>&lt;TargetsFile Include="Custom.targets"/&gt;
  </code></pre>
  
  <p>I right-clicked the file in the IDE's Project Manager and selected <code>Enable</code>. But when the project is built the <code>Build</code> message window displays:</p>
  
  <blockquote>
    <p>[MSBuild Warning] Custom.targets(1): Ignoring disabled import: <code>PathToProjectSource\\Custom.targets</code></p>
  </blockquote>
  
  <p>Right-clicking again in Project Manager still shows the <code>Enable</code> option instead of the expected <code>Disable</code>.</p>
  
  <p>At the command line <code>MSBuild ProjectName.dproj /t:Hello</code> also fails.</p>
  
  <p>I've tried hacking the <code>.dproj</code> file to add the line...</p>
  
  <pre><code>&lt;Import Project="Custom.targets"/&gt;
  </code></pre>
  
  <p>Typing <code>MSBuild ProjectName.dproj /t:Hello</code> now works. But the next time I save the project file from the IDE the <code>&lt;Import&gt;</code> statement gets removed.</p>
  
  <p>Anyone got any idea what's going wrong please?</p>