dotnet-appsettings 1.0.0-rc1

This is a prerelease version of dotnet-appsettings.
dotnet tool install --global dotnet-appsettings --version 1.0.0-rc1
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local dotnet-appsettings --version 1.0.0-rc1
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=dotnet-appsettings&version=1.0.0-rc1&prerelease
nuke :add-package dotnet-appsettings --version 1.0.0-rc1

dotnet-appsettings - .NET tools

Tool convert appsettings (.json) files to Azure AppService Application Settings json name-value format (support bulk updating) or Docker Compose environment format (yaml).

Nuget package

NuGet

Build Status

Build Status

Getting started

.NET 8.0 Support

  • Package version 1.0.0 supports .NET SDK 8.0, .NET SDK 7.0, .NET SDK 6.0, .NET SDK 5.0 and .NETCore SDK 3.1.

Samples

  • appsettings.json
{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  },
  "Array": [
    {
      "Name": "!Value1"
    },
    {
      "Name": "@Value2"
    }
  ],
  "!Key3": "Value &3 + 4",
  "AllowedHosts": "*"
}
  • Environment array syntax format for Docker compose file docker-compose.yml
services:
  webapi:
    environment:
      - '!Key3=Value &3 + 4'
      - AllowedHosts=*
      - Array__0__Name=!Value1
      - Array__1__Name=@Value2
      - Logging__LogLevel__Default=Information
      - Logging__LogLevel__Microsoft=Warning
      - Logging__LogLevel__Microsoft.Hosting.Lifetime=Information
  • Environment map syntax format for Docker compose file docker-compose.yml
services:
  webapi:
    environment:
      '!Key3': Value &3 + 4
      AllowedHosts: '*'
      Array__0__Name: '!Value1'
      Array__1__Name: '@Value2'
      Logging__LogLevel__Default: Information
      Logging__LogLevel__Microsoft: Warning
      Logging__LogLevel__Microsoft.Hosting.Lifetime: Information
  • Environment json format for launchSettings.json
{
  "profiles": {
    "ConsoleApp1": {
      "commandName": "Project",
      "environmentVariables": {
        "!Key3": "Value \u00263 \u002B 4",
        "AllowedHosts": "*",
        "Array__0__Name": "!Value1",
        "Array__1__Name": "@Value2",
        "Logging__LogLevel__Default": "Information",
        "Logging__LogLevel__Microsoft": "Warning",
        "Logging__LogLevel__Microsoft.Hosting.Lifetime": "Information"
      }
    }
  }
}

Edit in bulk

[
  {
    "name": "!Key3",
    "value": "Value \u00263 \u002B 4",
    "slotSetting": false
  },
  {
    "name": "AllowedHosts",
    "value": "*",
    "slotSetting": false
  },
  {
    "name": "Array__0__Name",
    "value": "!Value1",
    "slotSetting": false
  },
  {
    "name": "Array__1__Name",
    "value": "@Value2",
    "slotSetting": false
  },
  {
    "name": "Logging__LogLevel__Default",
    "value": "Information",
    "slotSetting": false
  },
  {
    "name": "Logging__LogLevel__Microsoft",
    "value": "Warning",
    "slotSetting": false
  },
  {
    "name": "Logging__LogLevel__Microsoft.Hosting.Lifetime",
    "value": "Information",
    "slotSetting": false
  }
]
  • Text format for manually update Azure AppService / Configuration / Application Settings
!Key3
Value &3 + 4

AllowedHosts
*

Array__0__Name
!Value1

Array__1__Name
@Value2

Logging__LogLevel__Default
Information

Logging__LogLevel__Microsoft
Warning

Logging__LogLevel__Microsoft.Hosting.Lifetime
Information

Installation dotnet tool globally

Download and install the .NET SDK. The tool still supports .NETCore 3.1 SDK and .NET 5.0 SDK for a moment. Once installed the .NET SDK, run the following command to install the tool:

dotnet tool install --global dotnet-appsettings

If you already have a previous version of dotnet-appsettings installed, you can upgrade to the latest version using the following command:

dotnet tool update --global dotnet-appsettings

Usage

appsettings appsettings.json appsettings.Production.json

Installation dotnet tool to a path

You can install the tool dotnet-appsettings to a folder

dotnet tool install dotnet-appsettings --tool-path C:\Development\Project1\tools

Usage

C:\Development\Project1\tools\appsettings.exe appsettings.json appsettings.Production.json

Installation dotnet tool locally

You can either install the tool locally in the project folder scope as https://docs.microsoft.com/en-us/dotnet/core/tools/local-tools-how-to-use

cd /d C:\Development\Project1
dotnet new tool-manifest
dotnet tool install dotnet-appsettings

Usage

C:\Development\Project1\Core> dotnet appsettings appsettings.json appsettings.Production.json

Usage

Command line global:
  appsettings [appsettings.json [appsettings.Production.json]]

Command line local:
  dotnet appsettings [appsettings.json [appsettings.Production.json]]

Command line tool path:
  "C:\Development\Project1\tools\appsettings.exe" [appsettings.json [appsettings.Production.json]]

C:\>appsettings.exe --help

Convert appsettings (.json) to Azure AppService Application Settings v0.2.3 Build:2023-01-27T11:30:11.448+08:00 .NET:.NETCoreApp,Version=v7.0

Usage: appsettings [arguments] [options]

Arguments:
  appsettingsFiles  appsettings.json appsettings.Production.json

Options:
  -p|--path <path>                          path to appsettings.json, appsettings.Production.json
  -o|--output-file <output-file.json>       path to output-file.json
  --slot-setting <appsettings.slotSetting>  specified file contains keys which SlotSetting=true
  -e|--environment                          output in docker compose environment Array syntax
  -m|--map-environment                      output in docker compose environment Map syntax
  -j|--json-environment                     output in environment json
  -t|--text                                 output in text format
  --skip-slot-setting                       skip SlotSetting=false
  --version                                 Show version information
  -?|-h|--help                              Show help information
  -v|--verbose                              Show verbose output.
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
1.0.0-rc1 166 1/14/2024
0.2.3 47,068 1/27/2023
0.2.2 964 1/11/2023
0.2.1 2,536 7/8/2022
0.2.0 1,135 11/10/2021
0.2.0-rc2 43,914 10/15/2021
0.2.0-rc1 67,425 9/15/2021
0.2.0-preview7 3,217 9/13/2021
0.1.2 66,800 7/6/2021
0.1.1 531 6/14/2021
0.1.0 532 6/5/2021
0.1.0-alpha1.2 188 6/5/2021