NuGet pack with include referenced projects

Yesterday I wanted to build a NuGet package with a dll that references a project in the same solution. The referenced project however was not added to the installation package when I packed a new Nuget package.

I searched the internet and found some remarks about adding a parameter includereferencedprojects.

Then I came to my pack command in Azure and saw that the parameter was not in the Nuget pack task.

The YAML i had:

At first I didn’t know how to add the includereferencedprojects parameter. I then changed the “automatic package versioning” in “pack options”. I set it to “Off” and an extra checkbox was presented:

I checked the box:

And set the versioning back to the previous value.

Now my YAML included the includereferencedprojects parameter.

After I started a new build with this pipeline, the referenced project dll’s were added to my package.