Thursday, March 3, 2011

How to get a .NET CCW assembly to load configuration from a dll.config

I have a .NET component exposed as a CCW (Com Callable Wrapper) and being loaded into an unmanaged IIS application (ATL server). The assembly is installed and registered with COM using regasm /codebase.

The component requires configuration such as is typically put into a Web.config file for an IIS app. But I don't want to drop the config into either w3pw.exe.config or machine.config - Ideally I'd like the configuration to be installed live along side the assembly that is exposed to COM.

I haven't found a way to achieve this. Since the COM assembly is loaded into the default AppDomain, so I don't think I can configure that domain to load from an alternate location.

From stackoverflow
  • You can try

    AppDomain.CurrentDomain.SetData ("APP_CONFIG_FILE",ConfigFile);
    

    Where ConfigFile is the full path to your application's app.config file.(c:\test\myapp.config) from Load App.Config data into a DLL

    David Messner : That worked, thanks.

0 comments:

Post a Comment