1

In my program, I have two different versions of the same dll, say A.dll, version 1.0 and 2.0. The method names within this dll are the same but internal functionality might differ for some of them. I want my program to use A.dll version 1.0 if a particular condition is met, else version 2.0. Is there any way to do that? I saw this but I dont think this is exactly what I need.

Edit : I need to decide based on a 3rd party software installed on the system, the version of this party software gives me a hint on which version of the dll to use.

Saad Khattak
  • 58
  • 1
  • 7
  • 1
    "_I want to my project to use A.dll version 1.0 if a particular condition is met, else version 2.0_" Does this mean that it is a build-time condition when you are building your project, or is it rather a condition that is defined and decided upon when your program is running? (You using the term "project" makes it unclear to me whether it is one or the other...) –  Aug 30 '22 at 10:36
  • What is the condition on which this is based? – ADyson Aug 30 '22 at 10:36
  • @ADyson Condition is based on version of the software being installed on the pc – Saad Khattak Aug 30 '22 at 10:37
  • @MySkullCaveIsADarkPlace I want to decide based on version of a software installed, since the dll is coming from there and this gives me a good hint which version of the dll I must use. So I am not sure which is the best way, build-time condition or run-time. – Saad Khattak Aug 30 '22 at 10:38
  • You mean the version of your own software? Then surely you just need two different builds of your software, each of which references the version of the DLL it needs to use? Then you just distribute whichever build is needed. It's a bit unclear what the issue is – ADyson Aug 30 '22 at 10:38
  • Or are you talking about the version of some 3rd party software which is installed on the PC already, and you want to use a DLL from that? – ADyson Aug 30 '22 at 10:39
  • @ADyson no, the version of another software (this is where the dll comes from too) – Saad Khattak Aug 30 '22 at 10:39
  • Are you asking about a .NET DLL or a x86 DLL? – JAlex Aug 30 '22 at 12:57
  • @JAlex .Net DLL – Saad Khattak Sep 01 '22 at 06:36
  • I'd have a more specific use case that seems to fit @saa – Michael Sep 02 '22 at 15:43
  • I'd have a more specific use case that seems to fit @SaadKhattak question: IdentityServer3 requires System.IdentityModel.Tokens.Jwt Version 4.x while Office 365 requires System.IdentityModel.Tokens.Jwt Version 5.x or 6.x. As those two versions are incompatible integration with Office 365 is broken without a massive rewrite of the whole security system as JWT tokens generated with <= 4.x can not be validated with >= 5.x and vice versa. Being able to use both versions of the dll (or NuGet package) at the same time would solve the problem. – Michael Sep 02 '22 at 15:53

0 Answers0