Create app config file if doesn't exist C#
问题 When I try to open my app config file by ConfigurationManager.OpenExeConfiguration(filePath); it returns an exception, because there is no file. But I need to create this file in this case. But as I know, config file create by adding at VS like How to: Add an Application Configuration File to a C# Project So, how to create this file in other way? 回答1: If you really want to create an empty config file at runtime you can do something like this, but note that if the config file already exists