Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8140447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:10:22+00:00 2026-06-06T12:10:22+00:00

I am a beginner with MSBuild. So far I have been able to create

  • 0

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.

I have also included this in my .targets file (under the project tag):

<ItemGroup>
    <AvailableItemName Include="CreateTextFileAction" />
</ItemGroup>

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)

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?

For reference, my .targets file:

<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <ItemGroup>
        <AvailableItemName Include="CreateTextFileAction" />
    </ItemGroup>

    <UsingTask AssemblyFile="CustomMSBuildTask.dll" TaskName="CustomMSBuildTask.MakeTextFile" />


   <Target Name="MyTarget">
       <MakeTextFile Contents="TODO HOW DO I GRAB MARKED FILES?" />
   </Target>
</Project>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T12:10:24+00:00Added an answer on June 6, 2026 at 12:10 pm

    A csproj file has a defined set of targets. The three main entry points are Build, Rebuild and Clean. These targets each have a set of dependencies. If you write your own targets to be part of the standard csproj build you need to find a suitable injection point within these dependencies.

    For ease of use there are two standard targets for you to override called BeforeBuild and AfterBuild. If you define this in the csproj file (after the import of the csharp targets file) and call your custom task in there then it should work (or at least move further along).

       <Target Name="BeforeBuild">
           <MakeTextFile Contents="TODO HOW DO I GRAB MARKED FILES?" />
       </Target>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Beginner to assembly programming for x86. I have a simple asm file which I
Git beginner question: I have a small private webproject which is versioned locally with
Complete beginner to Rails here: In Rails: I have a Model Post, which hasmany
Python beginner here. I am iterating through a text file, column by column. for
Beginner iOS dev here. I have a problem in my array. Im making an
Beginner in Android development. My code crashes. I have made a simple Java method
Beginner level question Scenario: Have simple string cocantation tool, that I might expand later
Beginner help needed :) I am doign an example form a php book which
Beginner question: I have a dictionary where the values are lists of (a variable
Python beginner here, I have a list of lists and want to refer to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.