JustLooking
JustLooking

Reputation: 2486

ASP.NET Core 2.2 - How to retreive NuGet Package Dependencies from Assembly that a Project References

I have a project ("Project1") that has a reference to an Assembly that I created in another project ("Project2").

I just added a function to a class in that assembly, but that function required me to add the NuGet package System.Drawing.Common. Which isn't an issue.

Here's the issue:

When I build Project1, it does not bring System.Drawing.Common.DLL to the bin folder. So, at runtime, when I execute this new function, I get an error stating that it can't find this DLL.

Is there a way that I can have Project1 bring along all of the Assembly's dependencies? Or do I have to instead add all the same NuGet packages that Project2/Assembly uses to Project1?

I'd prefer the former. I'm using ASP.NET Core 2.2 and Visual Studio 2017.

Thank you.

Upvotes: 0

Views: 244

Answers (1)

Ryan Condron
Ryan Condron

Reputation: 429

The build command with .NET Core 2.2 does not bring in the dependencies by default this is for testing only. If you are wanting all the dependency .dll to be included for deployment you should use the publish command to get all the .dll from your NuGet packages. There are other switches to include the framework as well so you don't need to install the framework, on the host.

As a friendly reminder, Dot Net Core 2.2 support will end on December 23, 2019

Upvotes: 1

Related Questions