none
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"?>
    <configuration>

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

       <BobSettings>     
          <ASetOfSettings>
          . . . .
          </ASetOfSettings>
       </BobSettings>    
    </configuration>


    I want to include system configuration settings such as the following

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

    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.

    Thanks

    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
    Moderator