Automatically set appsettings.json for dev and release environments in asp.net core?

Update for .NET Core 3.0+ You can use CreateDefaultBuilder which will automatically build and pass a configuration object to your startup class: WebHost.CreateDefaultBuilder(args).UseStartup<Startup>(); public class Startup { public Startup(IConfiguration configuration) // automatically injected { Configuration = configuration; } public IConfiguration Configuration { get; } /* … */ } CreateDefaultBuilder automatically includes the appropriate appsettings.Environment.json file … Read more

Opening the Settings app from another app

As mentioned by Karan Dua this is now possible in iOS8 using UIApplicationOpenSettingsURLString see Apple’s Documentation. Example: Swift 4.2 UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!) In Swift 3: UIApplication.shared.open(URL(string:UIApplicationOpenSettingsURLString)!) In Swift 2: UIApplication.sharedApplication().openURL(NSURL(string:UIApplicationOpenSettingsURLString)!) In Objective-C [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]; Prior to iOS 8: You can not. As you said this has been covered many times and that pop up … Read more

Getting value from appsettings.json in .net core

Program and Startup class .NET Core 2.x You don’t need to new IConfiguration in the Startup constructor. Its implementation will be injected by the DI system. // Program.cs public class Program { public static void Main(string[] args) { BuildWebHost(args).Run(); } public static IWebHost BuildWebHost(string[] args) => WebHost.CreateDefaultBuilder(args) .UseStartup<Startup>() .Build(); } // Startup.cs public class Startup … Read more

Reading settings from app.config or web.config in .NET

For a sample app.config file like below: <?xml version=”1.0″ encoding=”utf-8″ ?> <configuration> <appSettings> <add key=”countoffiles” value=”7″ /> <add key=”logfilelocation” value=”abc.txt” /> </appSettings> </configuration> You read the above application settings using the code shown below: using System.Configuration; You may also need to also add a reference to System.Configuration in your project if there isn’t one already. … Read more