workshas.blogg.se

Manage app settings myatt app
Manage app settings myatt app









In the following example the web.config has two settings that I want to change at deployment time (connection string and application setting). It would be the job of this second script to know where these configs are located and tie the property values to the functions above.

manage app settings myatt app

For example a software project might have a web.config for the web application but an app.config for a windows service. I wouldn’t be re-using this script from project to project as it has very specific details that only apply to one project. Next I needed a script file that was specific to the software project. $StringWriter = New-Object System.IO.StringWriter } function Set-ApplicationSetting ($fileName, $outFileName, $name, $value) This library of useful functions will be called Xml-Config.ps1 function Set-ConnectionString($fileName, $outFileName, $name, $value) I would use this script in all my projects that needed to have the ability to set connection and application settings. The first steps in creating this script is to have a set of functions that can easily be used to set the entries in a config file. Support changing connection strings and application settings in version 1 of this script.The web.config or app.config file is modified with the values that come from the property file.Dev, Test, Build etc) for a project that is accepted as a parameter into the script Support having 1 to N property files (i.e.Keep environment specific settings in a property file.

manage app settings myatt app

I thought it would be fun to do something similar using powershell. Usually you would run the console tool with a command line argument that would specify the environment that you wanted to configure and this tool would look up all the settings in a property file and make the changes in the app.config or web.config file. I have built a couple different console deployment tools over the years that handled this. Changing these settings by hand results in time consuming mistakes. You might have several environments that all have different configuration settings. Doing agile development means deploying your application very frequently into many environments.











Manage app settings myatt app