Accessing Config files in the COM World

G

Guest

Folks this may take a little while to explain but here goes.

I've got a VS 2005 .NET C# library (lets call it Elvis.dll because I'm sick
of seeing Foo) that I created that will be consumed by unmanaged C++ and VB6
clients. ComVisible is set to true at the Assembly level and the component is
in the GAC and I used regasm to generate the type library. The .NET library
uses a config file called lets say Elvis.config

I access this file is in the static constructor of the library by doing the
following C# code

static Elvis()
{
AppDomain.CurrentDomain.SetData(APP_CONFIG_FILE,
AppDomain.CurrentDomain.BaseDirectory + "\\Elvis.config");

_sideBurnLength = int.Parse(ConfigurationManager.AppSettings["SideBurns"]);
}

I've created a test MFC C++ and VB6 application to instantiate and call this
assembly and it works ON MY MACHINE (whose heard that before?). I should also
point out that my co-workers have helped me test this ON THEIR MACHINES and
it has worked as well.

Now here is where the issue arises. I created 2 machines from scratch. One
with Win 2000 Server 2000 SP4 and another with Win 2003 SP1. I then installed
..NET Framework 2.0 redistributable. I then installed Elvis.dll into the GAC.
Run regasm to generate the type library. I copied both "test" executables
(MFC C++ and VB6) and tried to run the application and neither one will
create the component and I discerned that they are both having trouble
loading the config file. The config file is in the same directory as the type
library that was generated and the test executables. The Elvis.dll assembly
is in the GAC.

If anyone has any thoughts I would appreciate them. Oh yea, one othe piece
of info. I also have a .NET "test" app called TestElvis.exe and it works fine
on the 2 machines that only have the .NET 2.0 runtime.

Thanks,
 
G

Guest

Can you put logging and see the path for
AppDomain.CurrentDomain.BaseDirectory on those 2 machines.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top