Specifying tempFilesLocation when exe.config file is not in the current folder. RRS feed

  • General discussion

  • A legacy .net 2.X winform application is using custom configuration file.

    <?xml version="1.0" encoding="utf-8"?>

          <section name="BobSettings" type="BobSettings, BobAssembly" />

          . . . .

    I want to include system configuration settings such as the following

            <xmlSerializer tempFilesLocation="d:\serializer\f1"/>
          <!-- Don't clean up files -->
               <add name="XmlSerialization.Compilation" value="true"/>

    This seems to work only if the configuration file is in the current folder of the executable. Specifically, I want the serialized assemblies to go to d:\serializer\f1. However, if the configuration file is in a parallel folder (e.g., <path>\config and <path>\bin, then the tempFilesLocation is not respected.

    The code does invoke OpenMappedExeConfiguration but I guess this is not used by the framework.
    I tried to find some code to set the tempFilesLocation after the fact. This option is not supported.

    What are my options, if any, for setting tempFilesLocation given that the config file is not in the current working folder.

    Setting this value in machine.config is not an option.
    I also know I can create a new AppDomain with the config file specified.
    Just wondering if there was anything else.


    • Changed type Mike Feng Tuesday, November 27, 2012 10:15 AM
    Monday, November 26, 2012 4:12 PM

All replies

  • Hi Ricky,

    Welcome to the MSDN Forum.

    Because you already have workaround, I change this thread type to discussion opening for any visions.

    Thank you.

    Best regards,

    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, November 27, 2012 10:14 AM