title: How do I use my .targets file in Visual Studio with custom build actions?
body: <p>I am a beginner with MSBuild. So far I have been able to create a custom task called 'MakeTextFile' which creates a text file in C:\ based on the contents property you pass it. This works running from a command line prompt.</p>
  
  <p>I have also included this in my .targets file (under the project tag):</p>
  
  <pre><code>&lt;ItemGroup&gt;
      &lt;AvailableItemName Include="CreateTextFileAction" /&gt;
  &lt;/ItemGroup&gt;
  </code></pre>
  
  <p>When I use the Import tag on my client applications .csproj I can now set items build actions to 'CreateTextFileAction', however the action never triggers (as no text file on C:\ is created)</p>
  
  <p>How do I get all the file paths of items that were marked with my build action 'CreateTextFileAction' and pass them onto my custom task?</p>
  
  <p><strong>For reference, my .targets file:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;
      &lt;ItemGroup&gt;
          &lt;AvailableItemName Include="CreateTextFileAction" /&gt;
      &lt;/ItemGroup&gt;
  
      &lt;UsingTask AssemblyFile="CustomMSBuildTask.dll" TaskName="CustomMSBuildTask.MakeTextFile" /&gt;
  
  
     &lt;Target Name="MyTarget"&gt;
         &lt;MakeTextFile Contents="TODO HOW DO I GRAB MARKED FILES?" /&gt;
     &lt;/Target&gt;
  &lt;/Project&gt;
  </code></pre>