Dave
Dave

Reputation: 1935

How to find the underlying OS from Startup class

I would like to have a different appsettings for MacOS and Windows. How can I retrieve from the Startup class the OS running my app in order to load the right appsettings.json ?

Upvotes: 2

Views: 22

Answers (1)

Joe Audette
Joe Audette

Reputation: 36736

public Startup(
        IConfiguration configuration, 
        IHostingEnvironment env

        )
    {

          var os = RuntimeInformation.OSDescription + " " + RuntimeInformation.OSArchitecture.ToString();

    }

Upvotes: 3

Related Questions