vorou
vorou

Reputation: 1909

How to handle transitive (NuGet) references in the full .NET framework?

I'm pretty sure the question is answered somewhere else, but my Google is not working.

I have a ConsoleApp and a ClassLib projects in my solution. ClassLib references and uses UltimateProblemSolver assembly which was installed via NuGet. ConsoleApp references ClassLib, but not UltimateProblemSolver.

In ConsoleApp I'm calling a method from ClassLib which uses UltimateProblemSolver. I'll get a runtime exception unless I install UltimateProblemSolver into ConsoleApp.

What am I doing wrong here? Am I supposed to manually install all the NuGet packages required by the library into any app that uses it?

Upvotes: 0

Views: 568

Answers (1)

Martin Ullrich
Martin Ullrich

Reputation: 100581

If you are using packages.config, then you need to install the NuGet Package into the console application as well.

If you are using the newer PackageReference format where the references are part of the .csproj file, then NuGet will handle transitive references for you.

Visual Studio can also migrate your projects from packages.config to PackageReference. See its migration documentation.

Upvotes: 1

Related Questions