SetOMatic 1.0.0.19

There is a newer version of this package available.
See the version list below for details.
dotnet add package SetOMatic --version 1.0.0.19
                    
NuGet\Install-Package SetOMatic -Version 1.0.0.19
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SetOMatic" Version="1.0.0.19" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SetOMatic" Version="1.0.0.19" />
                    
Directory.Packages.props
<PackageReference Include="SetOMatic" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SetOMatic --version 1.0.0.19
                    
#r "nuget: SetOMatic, 1.0.0.19"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SetOMatic@1.0.0.19
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SetOMatic&version=1.0.0.19
                    
Install as a Cake Addin
#tool nuget:?package=SetOMatic&version=1.0.0.19
                    
Install as a Cake Tool

About Set-O-Matic

As Visual Studio has evolved, the built-in SettingsManager library for .Net Framework projects has fallen far behind in functionality. While nearly all other aspects of code development have been integrated into Intellisense and have become strongly-typed, application settings are still only accessible by default as strings which are not visible via Intellisense. Newer .Net implementations have built-in mapping for configuration settings, but Framework projects still lack this basic tool. Until now.

Set-O-Matic is a simple set of T4 templates that, when added to any .Net Framework project via its package installation, automatically creates a strongly-typed Settings class that is dynamically loaded with values from App.config or Web.config at runtime.

Why use Set-O-Matic?

  • Strongly-typed application settings help prevent runtime errors by allowing the compiler to check setting types at compile time
  • As .Net class properties, all settings are available via IntelliSense at design-time, making selecting settings simple and error-free
  • Setting values in the config file are type-checked at first setting access at runtime, preventing invalid settings from falling through the cracks
  • Connection strings are automatically available through the Settings object
  • Compiler-checked code is cleaner code. Help the compiler help you!

Features

  • Extremely lightweight. Set-O-Matic adds a single folder and two code files (< 200 kb)
  • Completely Automates the importing of all configuration settings into a strongly typed Settings static class
  • Automatically loads the current configuration file setting values at runtime into the Settings object
  • Allows the use of IntelliSense to reference all application settings
  • Provides a connectionString child class(es) making all connection strings available via the Settings class
  • Supports custom configuration sections without the need to add any supporting code
  • Seamlessly handles transformed config files since values are loaded at runtime
  • Type-checking at application startup makes it easy to catch invalid values
  • Having strongly typed settings eliminates the need to cast settings throughout the application to match the type they are being used for
  • The ability to select any setting from IntelliSense greatly reduces the chances of "fat-finger" errors when referencing a setting
  • No dependencies to be deployed. All necessary functionality is included in complied application file (.exe)
  • Overall robustness of application code is increased due to fewer opportunities for errors

Config setting to Settings property Examples:

<add name="Active" value="true"> becomes public bool Active {get; set;}

Usage: if (Settings.Active){...}

<add name="CutoffDate" value="01/01/2025"> becomes public DateTime CutoffDate {get; set;}

Usage: DateTime endDt = Settings.CutoffDate;

Getting Started

Getting started with Set-O-Matic is simple:

  1. Install
  2. Start using the newly created static Settings class

Prerequisites

Set-O-Matic works with any .Net Framework project in any Visual Studio version that supports T4 templates and uses a Web.config or App.config file. There are no additional dependencies.

Installation

Install the Latest Set-O-Matic package from NuGet.org using the NuGet CLI ( $ dotnet add package SetOMatic --version 1.0.0.7 ) or Visual Studio's Package Manager.

Configuration

The Set-O-Matic class files (Settings.cs and SetOMatic.cs) will be created automatically in a new Settings folder in the root of the project. The Settings object can then immeidiatly be referenced in code and will contain all current settings and connection strings defined in the application's App.config or Web.config file.

No additiional configuration is needed

Usage

  1. Type Settings. in any code file. IntelliSense will list all available settings.
  2. Select the setting you wish to use.
Notes

Settings that are contained in the appSettings section of the config file can be accessed using Settings.appSettings. Custom application settings sections can be accessed using Settings.[custom_section_name]. :

Unlike when using .Net's ConfigurationManager class, no custom section code is required to access custom sections defined in the config file.

Connection strings contained in the connectionStrings section of the config file can be accessed using Settings.connectionStrings. Custom connection string sections can be accessed using Settings.[custom connection string section name].

Updating settings

If settings are added to or removed from the config file, the Settings class should be updated by right-clicking on the files

/Settings/SetOMatic.tt /Settings.Settings.tt

and selecting Run custom tool`

The Settings.cs and SetOMatic.cs files will be updated with the new settings.

There is no need to run the custom tool after modifying setting values only since they are loaded dynamically at runtime

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETFramework 4.5

    • No dependencies.
  • .NETFramework 4.6.2

    • No dependencies.
  • .NETFramework 4.7

    • No dependencies.
  • .NETFramework 4.7.2

    • No dependencies.
  • .NETFramework 4.8

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0.24 92 9/5/2025
1.0.0.23 90 9/5/2025
1.0.0.22 92 9/5/2025
1.0.0.21 95 9/5/2025
1.0.0.20 139 9/4/2025
1.0.0.19 139 9/4/2025
1.0.0.17 151 8/14/2025
1.0.0.16 153 8/14/2025
1.0.0.14 152 8/13/2025
1.0.0.12 264 8/11/2025 1.0.0.12 is deprecated because it has critical bugs.
1.0.0.11 155 8/11/2025
1.0.0.10 158 8/8/2025
1.0.0.9 235 8/6/2025

- Fixed formatting bug when mapping a config file with no settings
- Added exceptions when running in non-executable project
- Added notice in generated Settings.cs file when no settings were found