المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Could not find a part of the path



C# Programming
07-20-2009, 12:10 PM
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

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;
}
}
}


I'm not specifying the path anywhere except the configuration file name is you can see (configFileName variable).

Top Web Hosting Providers (http://www.webhostingyes.com/)[^ (http://www.webhostingyes.com/)]

Do, or do not. There is no 'try'.