NuGet Pack with IncludeReferencedProject in VSTS using BuildNumber Versioning

I recently needed to create a NuGet package from a project that had some dependencies on some other projects. Normally this isn’t a huge deal the following command would take care of it for you.

The VSTS NuGet task with the pack command doesn’t currently provide to pass the include referenced projects flag. I had to jump through a few hoops to get this to work so I thought I would share.

The first step is to add the NuGet Tool Installer task, all the default settings work fine. Next, after the NuGet Tool Installer task add the Run Inline Powershell task. This task takes a bit more configuration. In the Script to run field enter the following.

Then in the Arguments field enter the following.

If it hadn’t been for the version above which is based the Build Number the custom command type of the NuGet task would have worked fine.


Also published on Medium.

Leave a Reply

Your email address will not be published. Required fields are marked *