0

I have a C# solution that contains two net472 projects: Foo.csproj, and Bar.csproj.

The projects are in classic format (no SDK version).

The projects use PackageRefernce as package management.

Foo.csproj depends on Bar.csproj. Bar.csproj isn't a nuget package.

I want to create a nuget package of Foo.

I followed this instruction, and I execute the command msbuild -t:pack Foo.csproj, that produces the Foo.nupkg file.

The problem is that Foo.nupkg contains Foo.dll, but it doesn't contain Bar.dll. So, when I try to install via NuGet the package Foo, I receive the following error:

Unable to resolve dependency 'Bar'.

What I'm missing? I hope I have provided all the necessary info.

Placu95
  • 11
  • 2

1 Answers1

0

I had the same problem as explained above. My goal was to automate Azure Devops nuget package generation of two dependant assemblies and publishing one NuGet package. One of the steps in the Azure pipeline, actually includes execution of msbuild with -t:pack arguments.

After reading this thread: about advanced technics of creating NuGet packages, I've concluded that it's better to have 2 different packages. So I have ended up with modifiying inital pipeline job with additional 2 steps ("set assembly manifest data" and "Copy files") as on the picture. One set (of these steps) for A assembly and the other set for B assembly.

At the end result was two published Nuget packeges to the feed, where installation of A package in another project resulted auto installation of dependent B referenced package.

Hope this will help further others.

Azure pipeline agent job steps

KeiserSoze
  • 53
  • 10