Info
| Version: | 0.2.0 |
| Author(s): | dmitriy.martyscenko |
| Last Update: | Thursday, July 10, 2014 |
| .NET Fiddle: | Create the first Fiddle |
| Project Url: | https://github.com/DimaK0t/ConfigMocker |
| NuGet Url: | https://www.nuget.org/packages/ConfigMocker |
Install
Install-Package ConfigMocker
dotnet add package ConfigMocker
paket add ConfigMocker
ConfigMocker Download (Unzip the "nupkg" after downloading)
Create a "Web.config" variation with machine name in extension, eg "Web.PC-DEV.config".
Add your machine specific connection strings or app settings to that file, using standard .NET configuration elements.
Call new ConfigMocker.ConfigMocker.Mock(); during app init - it will replace default configuration with machine specific ones in runtime, if alternative config file was found for this machine.
NOTE: "configSource" attribute is also supported.
Just create new variation for config file specified in the attribute value. For example, for this line in the "Web.config":
<connectionStrings configSource="App_Config\ConnectionStrings.config" />
create a variation in "App_Config" folder with the name "ConnectionStrings.%PC-NAME%.config".