/build/static/layout/Breadcrumb_cap_w.png

XML Configuration

 

I have got a scenario : 

 

There is a config file which the installer installs and configures the values in the files based on property variables.   

 

Now after installation the User might configure some settings in the config file. And it gets encrypted with few new values in the complete section. 

 

The issue im facing right now is during upgrade. The config file might change (New settings included in the config file) but the installer has to retain the old values in the config file and include in the new file. 

 

Suppose my installed file looks like : 

  <connectionStrings>

    <add name="test" connectionString="test" providerName="test" />

  </connectionStrings>

 

And after installation the user configurations changes the connectionstring and it gets encrypted and it looks like this: 

 

  <connectionStrings New_Variable="test">

    <EncryptedData>

      <CipherData>

        <CipherValue>test</CipherValue>

      </CipherData>

    </EncryptedData>

  </connectionStrings>

 

So I need to update the new web.config file which is modified during next release version with these values. 

 

Any help would be appreciated. 

 

Regards, 

MS

 

0 Comments   [ + ] Show comments

Answers (3)

Posted by: philologist 12 years ago
Red Belt
1

Can you simply concatenate the old file contents onto the end of the new file using copy /y oldfile+newfile and have it work, or do you need to read the file in and parse it line by line looking for where to insert the current values?


Comments:
  • This link might help a little. http://stackoverflow.com/questions/1115508/batch-find-and-edit-lines-in-txt-file - philologist 12 years ago
Posted by: jagadeish 12 years ago
Red Belt
1

Where is this config file residing? In AllUsersProfile?


Comments:
  • Nah copying wont help as the file is in xml format.

    And the file is installed in program files.... - manitha21 12 years ago
  • Did I ask you to copy the xml file? :)

    You can read the xml file which is residing in %ProgramFiles% and update your new xml file based on that using VBScript custom action

    http://technet.microsoft.com/en-us/magazine/2008.02.heyscriptingguy.aspx?pr=PuzzleAnswer - jagadeish 12 years ago
Posted by: anonymous_9363 12 years ago
Red Belt
0

This is a distinctly non-trivial task.

I posted an XML class in VBS here a while ago. You could use that to read the content of the existing file into a new file, having renamed the existing one first.

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ