EnvRide provides an automated way to change everything in a XML file. Add, change or remove attributes and elements. Ideal to use on configuration files that have different values based on the Environment (Development, QA, Production, etc).
Developed in C# , XML and XPath.
Its based on XML and XPath, two widely used standards. It provides two ways of doing this:
*Command line Tool: A tool where you can call the EnvRide engine from the command line (e.g. Build scripts)
*Object Model: A C# .NET 3.5 API so you can use EnvRide in your own application
*Base File: The XML file that will be "overrided". This could be the configuration file that its used by the developers of an application.
*EnvRide file: Another XML file that defines the list of "Environments" for the Base file.
Lets say that you have a Base File
like this one, that its used when developing the application:
Example of a Base file
<connectionStringToDb value="Server=(local);Integrated Authentication=true"/>
The file above reflects the "Development Environment". Lets say that you need to deploy this application on the QA Server but there you have two dedicated machines, one for the Application and another for the DataBase. If you want your application
to be able to connect to the database you have to remember that when doing the deploy, you change the configuration file also.
Example of the QA Configuration File
This "manual" procedure (as every manual procedure) of changing the file can be forgotten or wrongly executed. Plus, imagine the situation where you have 7 environments and for each environment you have 23 keys to change. Its hard to keep track. You
could problably keep a copy of configurationeach file, but when you make a change in one, you have to remember to reflect that change in all the other. Its a decentralized way of managing configuration files.
Now lets review the same example but using the EnvRide:
Example of the EnvRide file
<Environment name="QA" outputFilePath="QA.config">
<Environment name="PROD" outputFilePath="PROD.config">
Notice that on the example above I configured two environments: QA and PROD (Production). On EnvRide you can define as many Environments as you want.
NOTE: When working with the EnvRide file, you can use the XSD Schema provided to validate and also help with the editing (There are editors that provide intelisense support for XML files with XSD Schema files e.g. Visual Studio 2005/2008, XmlSpy, etc).
Now to process the EnvRide file and generate the QA file, just call the EnvRide.exe command line tool with the following:
EnvRide.exe PATH_TO_ENV_RIDE_FILE /conf:PATH_TO_CONFIG_FILE /env:QA
To generated te PROD file:
EnvRide.exe PATH_TO_ENV_RIDE_FILE /conf:PATH_TO_CONFIG_FILE /env:PROD
NOTE: The EnvRide uses the CLAP library (CLAP stands for Command Line Argument Parser, its a library that i created to support the definition of command line arguments. It has a very easy to use object model so you can define and parse command line arguments).
If you want to know more about CLAP check the Source Code of EnvRide Command line to see its usage. I will try to create a project on CodePlex for CLAP too. Also if you want to use CLAP on your project, just add the reference for its library.
This is just the TIP of the iceberg for EnvRide. EnvRide was created to deal with the Configuration Files HELL when having multiple environments but it can be used with any XML file. With EnvRide you have:
*Add, Change or Remove Attributes and Elements of an XML File.
*Environment Inheritance: Yes, apply Environmental overrides in an cascade approach.
*PlaceHolders: Use placeholdes to make it easier to manage the overrides.
And most importantly:
ALL THIS IS AVALIABLE THROUGH THE COMMAND LINE AND API
Please check the Source Code for a complete example of all the features.