Hey I'm using the ExeConfigurationFileMap class's OpenMappedExeConfiguration method to open a config file. The config file is used by two programs in the same directory.
Everything is working fine on my development machine but when I copied the programs to another machine I get this error while executing the program
Code not find a part of the path D:\email\email.config
The other program can access the email.config file easily. Everything is one directory but the other program is pointing to the old path in my development machine :(
Here is a portion of the code which throws the Exception
class Program
{
static readonly string configFileName = "email.config";
static int Main(string[] args)
{
try
{
var configMap = new ExeConfigurationFileMap { ExeConfigFilename = configFileName };
Configuration externalConfig = ConfigurationManager.OpenMappedExeConfiguration(configMap, ConfigurationUserLevel.None);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
return 1;
}
}
}