c# - How to generate dependencies in nuspec (or nupkg contains dependencies in its metadata) from csproj -


say there solution, contains project a, b.

  • a referenced b in traditional way. (add reference -> projects -> b)

  • b depends on .net framework libs.

here do:

nuget pack a.csproj 

it generate a.nupkg without

<dependencies>       <dependency id="b" version="3.0" /> </dependencies> 

what want a.nupkg contains dependency on b in metadata.

i know can place a.nuspec under same folder of a.csproj, , set dependence on b in a.nuspec. costs manual work generate , maintain. since a.csproj knows b, there way can done without manual work?

or

any suggestion on this?

achieved add 2 targets in msbuild build script:

<genspeccommand>$(nugetcommand) spec -force</genspeccommand> <buildcommand>$(nugetcommand) pack "$(projectpath)" -p configuration=$(configuration) -o "$(packageoutputdir)" -includereferencedprojects</buildcommand> 

hope useful others.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -