.NET - load arbitrary web.config file

using System.Configuration;
using System.IO;
using System.Web.Configuration;
 
namespace ConsoleApp1
{
    class Program
    {
        public static Configuration OpenConfigFile(string configPath)
        {
            var configFile = new FileInfo(configPath);
            var vdm = new VirtualDirectoryMapping(configFile.DirectoryName, true, configFile.Name);
            var wcfm = new WebConfigurationFileMap();
            wcfm.VirtualDirectories.Add("/", vdm);
            return WebConfigurationManager.OpenMappedWebConfiguration(wcfm, "/");
        }
 
        static void Main(string[] args)
        {
            var config = OpenConfigFile(@"C:\Website\MyWebApp\web.config");
        }
    }
}