LaunchSettingsConfig 1.0.0.1

dotnet tool install --global LaunchSettingsConfig --version 1.0.0.1                
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 LaunchSettingsConfig --version 1.0.0.1                
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=LaunchSettingsConfig&version=1.0.0.1                
nuke :add-package LaunchSettingsConfig --version 1.0.0.1                

LaunchSettingsConfig - a global dotnet tool for re-ordering launch settings.

In Visual Studio, when you have a multi-project start-up, it can be time consuming to force each launchSettings.config file (either by editing or with the VS properties window) to use the deseried configuration. Especially as VS usually takes the top one, regardless of what one you select.

With this tool you can change all of your projects launch settings with one quick command.

To install, simply run:

dotnet tool install -g launchsettingsconfig

To use it is as simple as running:

launchsettingsconfig -a <environment>

For example, if your launchSettings.config looks like this:

{
  "profiles": {
    "Web.MVC - Development": {
      "commandName": "Project",
      "launchUrl": "http://localhost:62001/",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "applicationUrl": "http://localhost:62001"
    },
    "Web.MVC - Production": {
      "commandName": "Project",
      "launchUrl": "http://localhost:62001/",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Production"
      },
      "applicationUrl": "http://localhost:62001"
    },
    "Web.MVC - Test": {
      "commandName": "Project",
      "launchUrl": "http://localhost:62001/",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Test"
      },
      "applicationUrl": "http://localhost:62001"
    },
    "Web.MVC - LocalProduction": {
      "commandName": "Project",
      "launchUrl": "http://localhost:62001/",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "LocalProduction"
      },
      "applicationUrl": "http://localhost:62001"
    },
    "Web.MVC - LocalTest": {
      "commandName": "Project",
      "launchUrl": "http://localhost:62001/",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "LocalTest"
      },
      "applicationUrl": "http://localhost:62001"
    }
  }
}

Then running launchsettingsconfig -a localtest will bump the last one in the list above to the top, allowing you to quickly swap environments.

Options:

  • -a or --active environment - sets the desired ASPNETCORE_ENVIRONMENT to bump to the top.
  • -w or --working folder - sets the working directory to search. Buy default it'll use the current working folder.
  • -l or --loglevel log level - sets the log level, which by default is set to warning. Valid options are Verbose, Debug, Information, Warning, Error or Fatal.
  • -h or --help - display the help screen.

Notes

The matching is case-insensitive and and is based PURELY on the ASPNETCORE_ENVIRONMENT property.

It only supports this currently as it solved a problem for me. If anyone wishes to create a PR or fork, or even add it as a suggestion for alternatives, I'll gladly look at it. Things like the named profile spring to mind.

The project is pretty thin - one unit test to verify it's working, and was done pretty quick - so it's not great! I may tidy it up later, but for now it's working and I'm happy!

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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 was computed.  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 netcoreapp2.1 is compatible.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 2.1

    • No dependencies.
Version Downloads Last updated
1.0.0.1 1,090 6/17/2018