Expand Microsoft App Box in a Shared Folder

We create shared libraries that basically wrap over Microsoft Application Blocks (caching, logging, etc.).

I am trying to make this library available to multiple ASP.Net applications.

This library is deployed to a shared folder.

I created a custom container that will be used by the entire ASP.net application to consume any service (logging, caching), etc. from the library. The library folder location is used by the container to find the DLL.

All configuration for an Application Block is in app.config, which is dynamically loaded by Application Blocks.

The problem I'm running into is that Configuration is trying to load the Application Block, assuming the Application Block DLCs will be stored in the GAC, but for some reason I am unable to place the Application Block assemblies in the GAC. I have them in the same folder as the Dll library.

Because of this, the library dll cannot load the application block. I think one way to solve this question is to specify the CodeBase element in the runtime section in Machine.Config. I would like to know if there is a better way where I can specify the location of the application dlls in the config file.

Any thoughts?

Hello,

+2


source to share


2 answers


In .NET, you cannot (easily) share libraries between multiple applications unless they are hosted in the GAC.

AFAIR, the CodeBase element is only for specifying a specific COM component, so it exists to support COM interoperability. However, you can export your .NET library as a COM component and reference it via COM interop, but I would not recommend it because of the performance overhead as well as the maintenance overhead. Remember hellish hell? That this approach will lead you.

You should put your assemblies in the GAC if you need to share them across multiple applications.



Otherwise, you will need to deploy them with every application.

These are the only options with .NET.

+2


source


For some reason I am unable to put the app block assemblies in the GAC



Ent Lib 4.x comes with two DLL versions. One version has a strong name and can be added to the GAC; the other does not and cannot. If you are using version 4.x make sure you are trying to add files from C: \ Program Files \ Microsoft Enterprise Library 4.1 - October 2008 \ Bin and not from C: \ EntLib41Src \ bin and you should be fine. If not, can you tell us what the problem is - the GAC is the way to go, IMO.

+1


source







All Articles