ConfigurationSettings.AppSettings always returns null

  • Thread starter Thread starter Andrew Hayes
  • Start date Start date
A

Andrew Hayes

I'm not using One Touch or OpenNetCF, so none of the workarounds offered by
those search results work.

What I do have is a .NET 1.1 EXE which runs as a service on a machine
without IIS, and it used to work fine until I had to install .NET 2.0 because
of another application being installed. Now the call to
ConfigurationSettings.AppSettings always returns NULL.

I've tried adding the AppSettings section to the .NET 2.0. machine.config
and web.config files but with no change in the result. I've also tried
creating the appname.exe.config file in the same folder as the EXE, but that
doesn't help either.

Yes, I know ConfigurationSettings.AppSettings is obsolete so I should really
change the code and recompile it but I don't have VS 2005 (what's the point
of upgrading now when VS 2008 is just around the corner?)

So can anyone tell me where ConfigurationSettings.AppSettings is looking
when both .NET 1.1 and .NET 2.0 are installed? Or any other workaround that
would actually work?
 
I'm not using One Touch or OpenNetCF, so none of the workarounds offered by
those search results work.

What I do have is a .NET 1.1 EXE which runs as a service on a machine
without IIS, and it used to work fine until I had to install .NET 2.0 because
of another application being installed. Now the call to
ConfigurationSettings.AppSettings always returns NULL.

I've tried adding the AppSettings section to the .NET 2.0. machine.config
and web.config files but with no change in the result. I've also tried
creating the appname.exe.config file in the same folder as the EXE, but that
doesn't help either.

Yes, I know ConfigurationSettings.AppSettings is obsolete so I should really
change the code and recompile it but I don't have VS 2005 (what's the point
of upgrading now when VS 2008 is just around the corner?)

So can anyone tell me where ConfigurationSettings.AppSettings is looking
when both .NET 1.1 and .NET 2.0 are installed? Or any other workaround that
would actually work?

AppDomain.CurrentDomain.SetupInformation.ConfigurationFile
 
Back
Top