'How to avoid adding nuget package to project that references assemblies that uses a specific nuget package
My problem isn't new, and it isn't directly related to nuget either. It involves dll files and how .net searches for them during runtime.
My assembly A is referencing assembly B. A is using B to do sql work. I have tried to remove all code that would force assembly A to have the sql client directly available for successful compilation and it seems ok, it compiles. But still I get errors when running. It is complaining about dll not found. More specifically, the Microsoft.Data.SqlClient.SNI.dll. It is located in the published version of assembly B, which is referenced by A. Still it cant find it at runtime.
Solution is to install the sql package in assembly A, but I really don't want to do that. All exposed methods return objects that are not tied to SqlClient (dbDataReader instead of SqlDataReader etc).
Sorry if this has been asked and answered, and I believe (and hope) there is a quick fix, but I have just not found any thing to help me yet.
Edit: JBatStone's input forced me to do another try. If i reference the sqlclient assembly, as Rider suggets when trying to create, say, a SqlDataReader object, then it compiles without error, but I still get the same runtime error. So I can reference it, maybe through some pathing to Assembly B's bin. Still, I need to add the complete package to Assembly A to make it run correctly.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
