• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Conflicting references. Design problem?

 
Bartender
Posts: 669
15
TypeScript Fedora
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 15737
368
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 669
15
TypeScript Fedora
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 15737
368
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 669
15
TypeScript Fedora
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 669
15
TypeScript Fedora
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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        
 
when your children are suffering from your punishment, tell your them it will help them write good poetry when they are older. Like this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic