ConfigurationManager.OpenExeConfiguration gives wrong path on WHS RRS feed

  • Question

  • Hi,

    I'm having an issue with ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel) where it opens the wrong .config file when running our app on Windows Home Server. For example, say my application is installed to:

    C:\Program Files\My Application Name\myapp.exe

    ...and there's a corresponding config file in that directory called:

    C:\Program Files\My Application Name\myapp.exe.config

    ...under w2k, XP, and Vista, ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None) returns myapp.exe.config. However, under Windows Home Server, using the exact same codebase, I get the following path:

    C:\Program Files\My Application Name\myapp.config

    ...which is a file that doesn't exist, and doesn't contain any of our published application configuration details.

    I've seen other issues people have had with ConfigurationManager.OpenExeConfiguration, but it's typically with it adding an extra ".config", so the returned file ends up being "myapp.exe.config.config". Our issue is slightly different; the returned file ends up being "myapp.config"; I've looked through the code for ConfigurationManager.OpenExeConfiguration in reflector, but I'm still not sure why it's returning this file path. Also, I wrote a separate, standalone application too see if I could reproduce the issue, and I couldn't--so it could very well be some issue with our application's installer, or some code that runs prior to this code.

    Does anyone have any idea what could cause it to return the wrong config file? Or any ideas of things to try that may yield more information or a fix? I'm not sure if this is an issue specific to Windows Home Server, since nobody seems to have tried running our application on Windows Server 2003 (so it may occur there as well; I'll try to test this today).

    Thanks in advance,
    Friday, July 20, 2007 6:10 PM

All replies

  • One other interesting thing--on XP Pro, my System.Configuration.dll file (in my Microsoft.NET\Framework\v2.0.50727 directory) is version 2.0.50727.42.

    The same file, on Windows Home Server, is version 2.0.50727.842.  I'm going to try running this dll on XP and see what happens....and also compare them in reflector.
    Friday, July 20, 2007 6:57 PM