.NET 6 Custom Nuget package referencing other packages - Do I have to include the other packages myself?

28 Views Asked by At

In my project I am using a NuGet package that was written by the team that I'm a part of. Say it's called MyNugetPackage.

MyNugetPackage references another NuGet packages, such as Microsoft.Extensions.Caching.StackExchangeRedis package. This package is not included in my project. Just in MyNugetPackage.

The thing is - when I upload my code to the global CI/CD pipe we are working with - I'm getting an exception:

Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Extensions.Caching.StackExchangeRedis, Version=8.0.0.0, Culture=neutral, PublicKeyToken=[removed]'. The system cannot find the file specified.

I hate to say this, but everything works in my computer. It just fails the CI/CD process with this error.

My question is: how to solve this error? I had a speculation that maybe MyNugetPackage is not updated in the cloud and therefore can't find the path for StackExchangeRedis package.

Another option that I was thinking about is to include the missing NuGet packages in my project, but I have no idea if that's a good approach. I mean, we made MyNugetPackage, so why should my project include everything that nuget includes?

Thanks in advance.

Every change that I'm doing has to be followed with proper explanation. I can't just push my updates to the cloud without being sure that's the solution. So I only have speculations and not proper examples of what I tried.

0

There are 0 best solutions below