Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

Using different versions of the same DLL in a .NET class library [duplicate]

$
0
0

I have a pretty complicated case but I'll try to explain it. I have a project structured like following Project structureClass libraries "B" and "C" consume different version of the same NuGet package.

Problem 1: The v1 version of the NuGet package copies it's content to a folder "V1" and v2 - to a "V2" folder. How do I specify the path for class library "B" to use DLLs from "V1" folder and "C" - from "V2" folder? When I try to add usings in "B" and "C" to "V1" and "V2" respectively I get a compiler Error CS0246 "The type or namespace could not be found".

Problem 2: If problem 1 is solved, will class library "A" be able to use "B" and "C" without any additional changes? Or is it needed to add App.config file and specify attributes there or make any changes in .csproj file?

Note that Base class library is packed into NuGet package, so I don't have any Main application, I need to solve these problems on class library level.

I tried creating App.config file in both "B" and "C" with following content:

<configuration><runtime><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><probing privatePath="<V1 for "B" and V2 for "C")>" /></assemblyBinding></runtime></configuration>

But it doesn't seem to help. Is there any way to specify path in .csproj file?


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>