public static void UpdateSetup(SetupConfig setupConfig) { var rootDir = GlobalContext.ContentRootPath; using (var file = File.Open(Path.Combine(rootDir, _configFileName), FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite)) { using (StreamWriter sw = new StreamWriter(file)) { var content = JsonConvert.SerializeObject(setupConfig, Formatting.Indented); if (!string.IsNullOrEmpty(content)) { sw.Write(content.ToCharArray()); } } } }