简体   繁体   中英

Pack targets into nuget for clients

I'm creating nuget package that have some targets that should be installed for developers that use my package, ie in file my-targets.targets I have this lines:

  <Target Name="CleanGenerated" AfterTargets="Clean">
    ... do smthing ...
  </Target>
  <Target Name="Generate" BeforeTargets="Build">
    ... do smthing ...
  </Target>

How should I embeded this file with nuget so other developers would have those 2 build steps?

In the documentation , section "Including MSBuild props and targets in a package" you can read that you need to create a file with a ".targets" extension. Place that file in a "build" directory below the project root. In the NuSpec file you need to add a reference to that section:

<metadata>
  ...
</metadata>
<files>
   <file src="build\**" target="build" />
</files>

Depending on your NuGet version the installation of the package will behave differently; see the documentation for more details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM