This week's book giveaways are in the Cloud and AI/ML forums.
We're giving away four copies each of Cloud Native Patterns and Natural Language Processing and have the authors on-line!
See this thread and this one for details.
Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Conflicting references. Design problem?

 
Rancher
Posts: 457
6
IntelliJ IDE Spring Fedora
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have a project(class library) that uses the oracle data dll.  The problem is that the projects that use it also use the oracle dll but the version isn't necessarily the same. The main projects also use the oracle dll so they need to match.  The public API matches as far as I know so to get it to work I have multiple versions of the projects for each different dll.  The oracle versions are totally different not just small changes.

To clarify, the class library uses the oracle dll and then the project that uses the library also uses the oracle dll so they need to match.  There are different versions of the oracle dll and I want the class library to be able to use any of them because the API isn't different as far as the class library is concerned.
Is there a design flaw here or another way to get around it or will I have to have multiple versions?  Is there a way to have the class library not coupled to the oracle dll version?

thanks
 
Saloon Keeper
Posts: 10396
221
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you can do this by specifying the code bases for the different versions in the app.config.

https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/runtime/codebase-element

Just add a <codeBase> element with the version and path of the first library, and add another <codeBase> element with the version and path of the second library.
 
Al Hobbs
Rancher
Posts: 457
6
IntelliJ IDE Spring Fedora
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply.
I was looking into codebase and it requires app.config.  I am under the impression that class libraries don't have an app.config.  Or am I configuring the class library from another project's app.config?
 
Stephan van Hulst
Saloon Keeper
Posts: 10396
221
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Class libraries also don't include the assemblies they depend on. They don't know where the final location or what the name of the .dll files will be that they need. Only the application knows all this, so naturally you have to configure the <codeBase> elements in the app.config of the application.
 
Al Hobbs
Rancher
Posts: 457
6
IntelliJ IDE Spring Fedora
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I added the info to the app.config but because that information is for runtime, it won't build.  The error I get is :



I'm guessing it's not even looking at the app.config because it is just trying to compile.  

I found something on SO with a similar problem.  Link
The class library in question is using .net 1.1 so the configuration is different and not sure if it even has a condition attribute for the references.  Probably If I need to use the library again for higher .net versions I'll migrate it and have different build configurations for the different versions.
Doesn't really seem worth it at this point.

Maybe I'm doing it wrong though.  

 
Al Hobbs
Rancher
Posts: 457
6
IntelliJ IDE Spring Fedora
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok it turns out that I was doing it wrong.  What I did was I made the compiler happy by referencing the same oracle version as the dll.  I put the correct oracle dll in the exe folder and had the codebase info in the app.config.  I am assuming it works because the app was working fine. hehe

Working really well so far.  If I move the app to a different computer with a different oracle client all have to do is change the version number in the app.config. so simple and easy!!!
thanks so much        
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!