Hello,
Before Dublin is in charge, especially the Repository for the Web-services I’m using the custom code to manage the buzz with many URLs in Web.config files
There is a utility to change all URLs in .config files by one click.
1. Purpose.
In my current project we’ve got a lot of composite WCF-services. We have several environments: Development,Test1, Test2, Production.
We don’t have the service repository. That means when we move the services from one environment to another, we have to change addresses (URLs) in the <client> sections of all Web.config files (several dozens). Boring and error prone work, isn’t it?
In my current project we’ve got a lot of composite WCF-services. We have several environments: Development,Test1, Test2, Production.
We don’t have the service repository. That means when we move the services from one environment to another, we have to change addresses (URLs) in the <client> sections of all Web.config files (several dozens). Boring and error prone work, isn’t it?
The FilesModificatorAdmin utility was created to change all addresses in all Web.config files by one click.
2. How it works.
We define the files that should be scanned and changed. We define the root folder for search. We define the replacements substrings like “http://Env1.MyCompany.com/Composite/Promo/PromoService.svc”. The utility derives the searching substring RegExes from the replacement substrings like “”http[^\”]*?PromoService.svc”.
We define the files that should be scanned and changed. We define the root folder for search. We define the replacements substrings like “http://Env1.MyCompany.com/Composite/Promo/PromoService.svc”. The utility derives the searching substring RegExes from the replacement substrings like “”http[^\”]*?PromoService.svc”.
Then the FilesModificatorAdmin utility scans all defined files in all folder tree and replace the substrings.
Utility creates the copy of the changed files as OldName.copy.
Utility output the progress to the screen and optionally to the log file.
Utility could optionally just scan the files and show how many searching substrings were found and where.
Utility creates the copy of the changed files as OldName.copy.
Utility output the progress to the screen and optionally to the log file.
Utility could optionally just scan the files and show how many searching substrings were found and where.
3. Notes.
* The rules to derive the RegEx for the search are hard coded.
* If the FilesModificatorAdmin found the searching substrings but the string does not changed (it is possible because the searching sub string RegEx could find the substring that is equal the replacement substring) the FilesModificatorAdmin does not change the substring. In this case it shows that sub strings were found if option the “find only and do not replace the Substrings” is checked, and it shows that substrings were not found if option the “find only and do not replace the Substrings” is unchecked.
* The rules to derive the RegEx for the search are hard coded.
* If the FilesModificatorAdmin found the searching substrings but the string does not changed (it is possible because the searching sub string RegEx could find the substring that is equal the replacement substring) the FilesModificatorAdmin does not change the substring. In this case it shows that sub strings were found if option the “find only and do not replace the Substrings” is checked, and it shows that substrings were not found if option the “find only and do not replace the Substrings” is unchecked.
GLD (C) 2008