void EnableWpf(string arg, string configFile, bool primaryConfig) { const string console_type = "\"name\": \"Microsoft.NETCore.App\""; const string win_type = "\"name\": \"Microsoft.WindowsDesktop.App\""; var content = File.ReadAllText(configFile); if (arg == "enable" || arg == "1") { content = content.Replace(console_type, win_type); } else if (arg == "disabled" || arg == "0") { content = content.Replace(win_type, console_type); } File.WriteAllText(configFile, content); if (primaryConfig) { CSExecutor.print($"WPF support is {(content.Contains(win_type) ? "enabled" : "disabled")}"); } }
public void EnableWpf(string arg) { const string console_type = "\"name\": \"Microsoft.NETCore.App\""; const string win_type = "\"name\": \"Microsoft.WindowsDesktop.App\""; var configFile = Path.ChangeExtension(Assembly.GetExecutingAssembly().Location, ".runtimeconfig.json"); var content = File.ReadAllText(configFile); if (arg == "enable" || arg == "1") { content = content.Replace(console_type, win_type); } else if (arg == "disabled" || arg == "0") { content = content.Replace(win_type, console_type); } CSExecutor.print($"WPF support is {(content.Contains(win_type) ? "enabled" : "disabled")}"); File.WriteAllText(configFile, content); }