Skip to content

Latest commit

 

History

History
61 lines (38 loc) · 3.06 KB

README.md

File metadata and controls

61 lines (38 loc) · 3.06 KB

ConfigR

Write your .NET configuration files in C# 😎.

Fed up with XML soup? Frustrated that app settings can only be strings? Want to do more in your configuration file than just define app settings? Then ConfigR is for you!

Get it at NuGet.

Powered by scriptcs and Roslyn.

Quickstart

  • Create a console app in Visual Studio
  • Install ConfigR from NuGet
  • Add a new file named the same as your project output file with a csx extension, e.g. ConsoleAppliction1.exe.csx and in the file properties set Copy to Output Directory to Copy always
  • Add some configuration to the csx file e.g.
Configurator
    .Add("Count", 123)
    .Add("Uri", new Uri("https://github.com/config-r/config-r")); // regular C#, no restrictions!
  • Add some code to your project which uses the configuration, e.g.:
void Main(string[] args)
{ 
    var count = Configurator.Get<int>("Count");     // it's a System.Int32!
    var uri = Configurator.Get<Uri>("Uri");         // it's a System.Uri!
}

Congratulations! You've freed yourself from the shackles of XML and strings! 🏆

Advanced Usage

ConfigR does plenty more! Features include the ability to specify the path of your configuration file(s), multiple cascading configuration files and custom configurators. See the wiki for details.

TIP: you can write any C# you like in your 'configuration file' 😉. The scriptcs #load and #r features are both supported for loading scripts and referencing assemblies.

Updates

Releases will be pushed regularly to NuGet. For update notifications, follow @adamralph.

To build manually, clone or fork this repository and see 'How to build'.

Can I help to improve it and/or fix bugs?

Absolutely! Please feel free to raise issues, fork the source code, send pull requests, etc.

No pull request is too small. Even whitespace fixes are appreciated. Before you contribute anything make sure you read CONTRIBUTING.md.

What do the version numbers mean?

ConfigR uses Semantic Versioning. The current release is 0.x which means 'initial development'. Version 1.0 will follow the release of scriptcs version 1.0.

Sponsors

Our build server is kindly provided by CodeBetter and JetBrains.

YouTrack and TeamCity