# in file directory name causes System.Configuration.ConfigurationManager not to discover appsetings for .net core 2.0 app
The path to my project files has a hashtag # in it and I spent many hours trying to find out why my .net core 2.0 console app was not able to access the System.Configuration.ConfigurationManager.AppSettings. I thought it was a misspelling of the strings but when I moved the project folder out of the sub-directory with the hashtag, everything worked find.
\code\c#\projectfolder \code\projectfolder
I figured out the issue when I wrote a piece of code to see if I could add a setting key value pair, when the project was in the folder with the # (\code\c#\projectfolder). It resulted in a .config file being created in \code\c.config. I did not given any name to the config file. The setting should have appeared in the following file. \code\c#\projectname\bin\Debug\netcoreapp2.0\projectname.dll.config
Here is the code I had tested:
private static void _setConfigurationSettings()
{
string key = "MyCustomSettings2";
try
{
var configFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
var settings = configFile.AppSettings.Settings;
if (settings[key] == null)
{
settings.Add("MyCustomSettings2", "Hi This is my setting");
}
else
{
settings[key].Value = "My Setting hasChanged";
}
configFile.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection(configFile.AppSettings.SectionInformation.Name);
}
catch (ConfigurationErrorsException ex)
{
Console.WriteLine($"ERROR: {ex.ToString()}\n");
}
}
@anipik can you localize this? I wonder whether it's URI related.
I am on it.
@danmosemsft I am able to repro the bug on 2.0 as well as 2.1
@TrevorFradsham have you tried using the latest version of System.Configuration.ConfigurationManager nuget package? The problem is reproducible in version 4.4.1 but not anymore in 4.5.0-preview2-26406-04
Will give it a try
Thanks Trevor From: Maryam Ariyan Sent: Thursday, April 26, 2018 3:27 PM To: dotnet/corefx Reply To: dotnet/corefx Cc: Fradsham, Trevor; Mention Subject: Re: [dotnet/corefx] # in file directory name causes System.Configuration.ConfigurationManager not to discover appsetings for .net core 2.0 app (#29126)
@TrevorFradshamhttps://github.com/TrevorFradsham have you tried using the latest version of System.Configuration.ConfigurationManager nuget package. The problem is reproducible in version 4.4.1 but not anymore in 4.5.0-preview2-26406-04
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/dotnet/corefx/issues/29126#issuecomment-384732036, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AfcE35R9cOJeLs-tJFJ-1FGF2v-rXr1bks5tsgqSgaJpZM4TVl6Q.
Closing this issue as it is fixed on the newer version. @TrevorFradsham you can reopen if you still find an issue.