templating icon indicating copy to clipboard operation
templating copied to clipboard

Add item templates for Directory.Build.props and Directory.Build.targets

Open DamianEdwards opened this issue 3 years ago • 4 comments

I'm finding myself creating Directory.Build.props and Directory.Build.targets files more and more often these days and having item templates for those in the CLI would be helpful.

Directory.Build.props

Property Value
Name Directory.Build.props file
Short Name (idea 1) props
Short Name (idea 2) directorybuildprops
Language (blank)
Tags Build

Content:

<Project>
  <!-- See https://aka.ms/dotnet/msbuild/customize for more details on customizing your build -->
  <PropertyGroup>
    
  </PropertyGroup>

</Project>

Directory.Build.targets

Property Value
Name Directory.Build.targets file
Short Name (idea 1) targets
Short Name (idea 2) directorybuildtargets
Language (blank)
Tags Build

Content:

<Project>

  <!-- See https://aka.ms/dotnet/msbuild/customize for more details on customizing your build -->
  <Target Name="CustomAfterBuildTarget" AfterTargets="Build">
    
  </Target>

</Project>

@timheuer @dsplaisted @baronfel

DamianEdwards avatar Jul 21 '22 21:07 DamianEdwards

Great suggestion. IMO, props and targets are perhaps too generic names for these templates. On the other hand, directorybuildtargets is sort of long. Maybe directorytargets and directoryprops would work.

Or maybe there could be just one template that creates both the .props and .targets files. Maybe that could be called directorybuild.

dsplaisted avatar Jul 22 '22 15:07 dsplaisted

What do you think of buildprops and buildtargets? In contrast to something like slnprops/slntargets (for Directory.Solution.props/targets files).

baronfel avatar Jul 22 '22 16:07 baronfel

What do you think of buildprops and buildtargets? In contrast to something like slnprops/slntargets (for Directory.Solution.props/targets files).

That also works for me.

dsplaisted avatar Jul 22 '22 16:07 dsplaisted

Yep, dotnet new buildprops works well for me too 👍

DamianEdwards avatar Jul 22 '22 19:07 DamianEdwards

@baronfel assigning to you, as you are working on it. Please let me know otherwise

vlada-shubina avatar Dec 05 '22 16:12 vlada-shubina

The buildprops and buildtargets templates should ship with 7.0.200 - thank you for the suggestion!

baronfel avatar Dec 20 '22 16:12 baronfel